Doug Meade

 

Doug

---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.edu

MaplePrimes Activity


These are answers submitted by Doug Meade

The general syntax of the piecewise command is:

piecewise( cond1, expr1, cond2, expr2, cond3, expr3, ..., condN, exprN, exprOTHER )

where cond1, cond2, ..., condN are Boolean conditions that evaluate to true or false. The way piecewise works is that it evaluates each cond one-by-one. If condJ evalualtes to true, then the value of this piecewise command is exprJ. If none of the cond statements evaluates to true, then piecewise returns the exprOTHER. (If exprOTHER is not provided, the default value when none of the conditions is true is 0.

So, you can use Robert's approach, it just will be much longer, for example:

X := piecewise( t>0 and t<1, expr1,
                t<2, expr2,
                t<3, expr3,
                 .
                 .
                 .
                t<80, expr80 );

I hope this helpful. You can see more examples in the online help for piecewise ( ?piecewise ).

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

This works for me in Maple 13. It did take quite a while for the plot to appear (several minutes), but it works as Robert shows.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

The dsolve command (?dsolve,numeic) now supports parameters even when finding numeric solutions. This makes it much easier to create the animation in Preben's previous post.

Here's how I would approach this problem:

sol := dsolve( {sys,f1(0)=a1,f2(0)=a2,g1(0)=0,g2(0)=0},
               numeric, parameters=[a1,a2] );

Notice that two of the initial conditions are not specified and that these values are declared as parameters.

pp := proc( a1::realcons, a2::realcons )
  sol( parameters=[a1,a2] );
  odeplot( sol, [t,f1(t)], t=0..6 );
end proc:
animate( pp, [a,1], a=0.5 .. 3 );

If it were possible to specify the parameter values inside the call to odeplot (?plots,odeplot), then the separate pp procedure could be completely eliminated. What I'd like to be able to write is the following:

animate( odeplot, [ sol( parameters=[a,1] ), [t,f1(t)], t=0..6 ], a=0.5..3 );

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

 

You can make send your request to Maple's technical support, or submit a software change request (SCR) through MaplePrimes.

In t his case, I would not hold my breath. I believe there is little interest within Maplesoft to enhance the functionality within the Maplets package.

In most cases it is possible to create a worksheet that can function very much like a standalone maplet. Is there a reason why you don't want to use a worksheet with embedded components?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

I admit that I've had to adjust to having details about commands in separate files, but I also know this has been helpful in convincing my students (new users) to look at and read the online help information.

Personally, if I was going to change anything about the online help, my first suggestion would be to have the Examples come at the beginning. I oftern have to tell my students several times to not be worried about all of the details (to them) that are in the main help page and concentrate on the examples. In most cases they can find an example that's close to what they need to do. My second request would be to take a careful look at the Examples with eye to providing examples that show as many of the different arguments and ways to use the command as possible.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

The new settings take effect on newly opened worksheets. Open a new worksheet and you should see the changes you made.

I might be nice if, after clicking Change ..., you saw a confirmation message that included a note that the changes will be seen in new worksheets (and not ones that are currently opened).

It is also worth noting that if you open a .mw file that was created using different settings, those settings override the default. Your defaults are only for new worksheets/documents.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

I tried something similar, with `if`, but didn't think to just make one component unplottable (i.e., undefined).

Based on your suggestion, here's how I would do this in one command:

animate( spacecurve, [ {[cos(t),sin(t),t, color=red],
                        [sin(t),cos(t),piecewise(t<Pi,undefined,t), color=blue]}, t=0..B ],
                       B=0..2*Pi, axes=boxed, labels=[x,y,z]);

It would be  nice if this could also work with the piecewise on the color option, for example:

animate( spacecurve, [ {[cos(t),sin(t),t, color=red],
                        [sin(t),cos(t),t, color=piecewise(t<Pi,white,blue)]}, t=0..B ],
                       B=0..2*Pi, axes=boxed, labels=[x,y,z]);

But, in this usage, the color option is not this robust.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Why did you change the paragraph styel to Maple Input? This overrides your choice of Maple Notation for the input display.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

It sounds as though you want to have it so that the entire worksheet automatically executes when it's opened.

If so, my suggestion is to select the entire worksheet, then set this selection to Autoexecute (as described above).

(My guess is that you followed my earlier instructions, which did not specify that you had to select the code to be autoexecuted. I apologize for this oversight.)

It might be simpler, but not automatic, to click on the !!! icon in the icon bar. This executes the entire worksheet whenever it is pressed.

I hope this is helpful.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

From the Maple GUI, under the Tools menu, select Options. Then, click on the Display tab, and change Input Display to Maple Notation.

Note, if you want to work with a worksheet instead of a document, you can click on the Interface tab and change the setting for "Default setting for new worksheets" to worksheet.

When you are done you have to apply any changes. To do this, at the bottom of this window, click on Apply Globally.

That should fulfill your request. Please let us know if you have any problems, or additional concerns.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Under the Format dropdown menu, one of the last entries is Autoexecute; select Set (or Clear or Clear All as appropriate). Then, a restart command will cause any autoexecute commands to be executed. There is also an Execute option under the Edit menu; here, you select the Repeat Autoexecute to do the obvious.

I hope this has been helpful,

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

What you see is actually both curves, but you don't see the red curve for the first few frames. Look at the vertical axis. It should start at 0, but it starts at around 3 (maybe Pi?). Notice also that the title in the first frame tells us that B=3.1416. The first part of the red curve is simply not displayed.

If you want to animate two curves, here is what I would do:

animate( spacecurve, [ {[cos(t),sin(t),t, color=red],[sin(t),cos(t),t, color=blue]}, t=0..B ], B=0..2*Pi, axes=boxed, labels=[x,y,z]);

But, what you really want is to show only the red curve when B=0..Pi and to show both of these curves when B=Pi..2*Pi. I have not yet succeeded in getting this in one plot, with the colors the way you want them. Maybe someone else will have enough time to show you how to do this - or you can play with it some on your own.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Personally, I find the DEplot command more flexible in situations like this.

To start, I just change dfieldplot to DEplot:

with(DEtools):
 DEplot(diff(y(x),x)=sin(y(x)), y(x), x=-3..3, y=-5..5);

Then, if I want to see the solution that passes through a specific point, say (Pi,2), I just add this to the list of arguments (as a list):

with(DEtools):
 DEplot(diff(y(x),x)=sin(y(x)), y(x), x=-3..3, y=-5..5, [y(Pi)=2]);

And, if I want to show more solution curves, I supply a list of initial conditions:

with(DEtools):
 DEplot(diff(y(x),x)=sin(y(x)), y(x), x=-3..3, y=-5..5, [ [y(Pi)=2], [y(Pi)=-2] ]);

I regret that I cannot include the plots in this post - that's a different topic.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

I don't see this problem. I am using Maple 13, under Windows XP. Here's my exact code:

restart;
with( Maplets[Elements] ):
GetIt := proc()
   local p, v;
   v:= Maplets:-Tools:-Get('SL1');
   plots[animate](plot,[t+x,x=-5..5,y=-5..5],t=0..v);
end proc:
maplet1 := Maplet(
   [Plotter['P1'](plot(0,x=-5..5,y=-5..5)),
    [Button("play",SetOption(P1('play')=true)),
     Button("stop",SetOption(P1('`stop`')=true)),
     Button("pause",SetOption(P1('pause')=true))
    ],
    [Button("to start",SetOption(P1('to_start')=true)),
     Button("to end",SetOption(P1('to_end')=true))
    ],
    [Button("backwards",SetOption(P1('frame_backwards')=true)),
     Button("forward",SetOption(P1('frame_forward')=true))
    ],
     Slider['SL1'](0..100,10,'showticks','majorticks'=10), 
    [Button("What", Evaluate('P1' = "GetIt")), 
     Button("OK", Shutdown([]))
    ]
   ]
  ):
Maplets[Display](maplet1):

I replaced your TextField TF1 with a Plotter element P1, and added buttons to control the resulting animation. It's not fancy; you can clean it up as you desire.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Your PDE can be used to help with this. The PDE allows you to rewrite u_t in terms of u_x and u_xx. When you integrate wrt x these become u and u_x, evaluated at x=0 and x=5. You know u(0,t) and u(5,t) are both 0, so all that remains is an expression involving u_x(0,t) and u_x(5,t).

Does this help?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
First 10 11 12 13 14 15 16 Last Page 12 of 44