RE: question about plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg69695] RE: [mg69652] question about plot*From*: "David Park" <djmp at earthlink.net>*Date*: Thu, 21 Sep 2006 07:29:18 -0400 (EDT)

Here is your animation. Needs["Graphics`"] delta[n_][x_] := n/(Sqrt[Pi]/E^((-n^2)*x^2)) frame[n_] := Plot[delta[n][x], {x, -2, 2}, PlotRange -> {-0.1, 6.1}, Frame -> True, PlotLabel -> SequenceForm[delta["n"][x], ", n =", NumberForm[n, {4, 2}, NumberPadding -> {" ", "0"}]], ImageSize -> {800, 500}]; Animate[frame[n], {n, 1, 10, 0.25}] SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5]; FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1, AnimationDirection -> ForwardBackward]}] I usually like to keep the 'parameters' separate from the 'variable' in the definition of delta, although in this case it wouldn't matter. (The extra brackets are called 'subvalues'.) In making animations I like to define a frame function that plots one frame of the animation and then use the Animate statement (from Graphics`Animation`) to actually carry out the animation. Then I can test individual frames and make changes before doing the entire animation. In making an animation such as this, it is ALWAYS necessary to specify a specific PlotRange. You can't use All. This is because you must have the same PlotRange for all frames and Mathematica usually tries to pick the 'most interesting part', and All will not be the same for all frames. When putting n on the plot, it is usually necessary to use NumberForm with a NumberPadding specification so the number will always fit into the same space. Otherwise you will get a jumping effect for different frames. In the Animate statement I have added commands that select the generated frames, close them up and start the animation. For those who have DrawGraphics these commands can be pasted in from the DrawGraphics palette. In viewing an animation like this it is useful to know that you can use the keyboard to step through the animation. This is often the best way to view an animation. 1) The up/down arrow keys will allow you to advance one frame at a time. 2) The right/left arrow keys will put in animation into the forward or backward direction. 3) The number keys will control the speed of the animation. 4) 'p' will pause and restart the animation. 5) 'c' will restart the animation in the forward-backward mode. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: dimmechan at yahoo.com [mailto:dimmechan at yahoo.com] To: mathgroup at smc.vnet.net Hi. I define a delta sequence. Needs["Graphics`"] delta[n_, x_] := n/(Sqrt[Pi]/E^((-n^2)*x^2)) I can't understand what I do wrong in the following command. I really appreciate any comments. Show[(Plot[delta[#1, x], {x, -2, 2}, DisplayFunction -> Identity, PlotRange -> All, ImageSize -> {800, 500}, PlotStyle -> Hue[#1], PlotLegend -> StringJoin["n= ", ToString[#1]]] & ) /@ Range[0, 10], DisplayFunction -> $DisplayFunction] Thanks