Re: Animating Solutions of NDSolve with respect to Initial Conditions
- To: mathgroup at smc.vnet.net
- Subject: [mg52543] Re: Animating Solutions of NDSolve with respect to Initial Conditions
- From: Peter Pein <petsie at arcor.de>
- Date: Wed, 1 Dec 2004 05:58:20 -0500 (EST)
- References: <cohjd6$1of$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Narasimham G.L. wrote: > To see all circularly bent shapes of a strip fixed at one end it is > animated as follows: > > << Graphics`Animation` > MovieParametricPlot[{Sin[t*s]/t , (1 - Cos[t*s])/t}, {s, 0, 2 Pi}, > {t, -1,1}, Frames -> 20, Axes -> False, AspectRatio -> Automatic, > PlotRange -> {{-3, 7}, {-3, 7}}]; > > Like the above and unlike the example below where solutions are > superimposed in Show mode in a single frame, I like to animate an > NDSolve output to varoious Boundary Conditions to see their effect > dynamically in separate frames. How can this be done? > > yvar = y /. > First /@ (NDSolve[{y'''[t] + y[t] == 0, y[0] == #1, y'[0] == #2, > y''[0] == #3}, y, {t, 0, 2 Pi}] & @@@ {{5, 1, -2}, {5, > 1, -1}, {5, 1, 0}, {5, 1, 1}, {5, 1, 2}}); > Plot[Evaluate[#[t] & /@ yvar], {t, 0, 5}]; > You nearly got it: yvar = y /. First /@ (NDSolve[{y'''[t] + y[t] == 0, y[0] == #1, y'[0] == #2, y''[0] == #3}, y, {t, 0, 2 Pi}] & @@@ Table[{5, 1, p}, {p, -2, 2, .1}]); Plot[#, {t, 0, 5}, PlotRange -> {-40, 10}] & /@ Evaluate[#[t] & /@ yvar]; -- Peter Pein 10245 Berlin