Re: Animate parametric plot of two lists?

• To: mathgroup at smc.vnet.net
• Subject: [mg132314] Re: Animate parametric plot of two lists?
• From: lyubov78 at gmail.com
• Date: Sat, 8 Feb 2014 04:02:10 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net
• References: <27402470.1247054225882.JavaMail.root@n11> <h340l6\$ggq\$1@smc.vnet.net>

Thank you for interesting questions!!!

You wrote in the beginning: it's simple
to animate the parametric plot of them by using ParametricPlot inside
Animate.

But I cannot animate the NDSolve using ParametricPlot.
Can you please tell me why I get errors like "NDSolve::dsvar: 1.0011952113073699` cannot be used as a variable. ":

Animate[
ParametricPlot[
{Evaluate[{y[p], x[p]} /. sol =
NDSolve[...some equation type D[f1[x[p],y[p],p] = -D[x[p], p],
f2[x[p],y[p],p] = -D[y[p], p]
x[1] == -1, y[1] == -1}, {y[p], x[p]}, {p, 1, Tp}]]},
{p, 1, Tp}], {Tp, 1, 100}]

Thank you!

On Thursday, July 9, 2009 7:53:42 AM UTC+2, David Park wrote:
> I'm not certain which is better, to store a large number of complete plots,
> or to generate each one.
>
> Generating each of the plots, which seems to be rapid enough for me, could
> be done as follows.
>
> f[t_] := Cos[t]
> g[t_] := Sin[t]
>
> list1 = Table[f[t], {t, 0, 2 Pi, .1}];
> list2 = Table[g[t], {t, 0, 2 Pi, .1}];
>
> n = Length[list1];
>
> Animate[
>  Show[
>   ListPlot[Take[plotdat, k],
>    Joined -> True,
>    PlotStyle -> {Red, Dashed},
>    AspectRatio -> Automatic,
>    PlotRange -> 1.2],
>   ListPlot[Take[plotdat, k],
>    PlotMarkers -> {Automatic, 12},
>    AspectRatio -> Automatic,
>    PlotRange -> 1.2]
>   ],
>  {k, 1, n, 1}]
>
> But not (for some reason that I don't understand) as follows:
>
> Animate[
>  Show[
>   ListPlot[Take[plotdat, k],
>    PlotMarkers -> {Automatic, 12},
>    AspectRatio -> Automatic,
>    PlotRange -> 1.2],
>   ListPlot[Take[plotdat, k],
>    Joined -> True,
>    PlotStyle -> {Red, Dashed},
>    AspectRatio -> Automatic,
>    PlotRange -> 1.2]
>   ],
>  {k, 1, n, 1}]
>
> But, as usual, I find it easier to do it with Presentations where the
> various uses of the options are untangled and the order doesn't matter.
>
> Needs["Presentations`Master`"]
>
> Animate[
>  Draw2D[
>   {ListDraw[Take[plotdat, k],
>     PlotMarkers -> {Automatic, 12}],
>    ListDraw[Take[plotdat, k],
>     Joined -> True,
>     PlotStyle -> {Red, Dashed}]},
>   Axes -> True,
>   PlotRange -> 1.2],
>  {k, 1, n, 1}]
>
> If you wanted to pre-compute all of the frames, you could just pre-compute
> the primitives without generating the entire plots.
>
> Clear[frame]
> frame[k_]:={ListDraw[Take[plotdat,k],
> PlotMarkers->{Automatic,12}],
> ListDraw[Take[plotdat,k],
> Joined->True,
> PlotStyle->{Red,Dashed}]};
> framelist=Table[frame[k],{k,1,n}];
>
> Animate[
>  Draw2D[
>   {framelist[[k]]},
>   PlotRange -> 1.2,
>   Axes -> True],
>  {k, 1, n, 1}]
>
>
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/
>
>
> From: Porscha Louise McRobbie [mailto:pmcrobbi at umich.edu]
>
> Hello,
>
> When I have explicit formulas for two functions of time, it's simple
> to animate the parametric plot of them by using ParametricPlot inside
> Animate.
>
> I'd like to create a similar animation now, but using two lists of
> numbers. Apparently there is  no function such as ListParametricPlot.
>
> Below a roundabout way I found (I want to show both a dashed line and
> a point tracing out the curve in time). Is there a better way to do
> this? I'd like to be able to include many more frames, and this method
> seems inefficient.
>
> Any suggestion/help is appreciated.
>
> Porscha
>
>
>
> (*Animate a parametric plot from two lists*)
> In[1]:= f[t_] := Cos[t]
> In[2]:= g[t_] := Sin[t]
>
> In[27]:= list1 = Table[f[t], {t, 0, 2 Pi, .1}];
> In[28]:= list2 = Table[g[t], {t, 0, 2 Pi, .1}];
>
> In[29]:= n = Length[list1];
> In[30]:= plotdat = Thread[{list1, list2}];
> In[31]:= frame = ConstantArray[0.0, n];
>
> In[32]:= Do[
>   frame[[j]] =
>    Show[ListLinePlot[plotdat[[1 ;; j]], PlotStyle -> {Red, Dashed},
>      PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}],
>     ListPlot[plotdat[[1 ;; j]],
>      PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}},
>      PlotMarkers -> {Automatic, 12}]], {j, 1, n}]
>
> In[33]:= ListAnimate[frame]

• Prev by Date: Re: Animate parametric plot of two lists?
• Next by Date: Goodstein expansion
• Previous by thread: Re: Animate parametric plot of two lists?
• Next by thread: Goodstein expansion