       Re: Varying a constant in an ODE to Manipulate solution

• To: mathgroup at smc.vnet.net
• Subject: [mg126868] Re: Varying a constant in an ODE to Manipulate solution
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Thu, 14 Jun 2012 05:32:38 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201206130857.EAA03730@smc.vnet.net>

```sol[c_] := {x[t], y[t], z[t]} /. First[
NDSolve[{y''[t] + Sin[y[t]/c] == 0,
y' == 0, y == 1/(1 + c),
x'[t] == t, x == c^2,
z'[t] == 2 c x[t] - y[t], z == 2},
{x, y, z}, {t, -3, 3}]]

Use a single Evaluate. For example,

Manipulate[
Plot[Evaluate[{sol[c][], sol[c][]}], {t, -3, 3},
PlotStyle -> {Green, Thick},
ImageSize -> 200,
AspectRatio -> Automatic,
PlotRange -> {{-3, 3}, {-1.05, 8.05}}],
{c, -0.5, 2, 0.2}]

Manipulate[
Plot[Evaluate[Most[sol[c]]], {t, -3, 3},
PlotStyle -> {Green, Thick},
ImageSize -> 200,
AspectRatio -> Automatic,
PlotRange -> {{-3, 3}, {-1.05, 8.05}}],
{c, -0.5, 2, 0.2}]

Manipulate[
Plot[Evaluate[Rest[sol[c]]], {t, -3, 3},
PlotStyle -> {Green, Thick},
ImageSize -> 200,
AspectRatio -> Automatic,
PlotRange -> {{-3, 3}, {-10, 10}}],
{c, -0.5, 2, 0.2}]

Manipulate[
Plot[Evaluate[Drop[sol[c], {2}]], {t, -3, 3},
PlotStyle -> {Green, Thick},
ImageSize -> 200,
AspectRatio -> Automatic,
PlotRange -> {{-3, 3}, {-10, 10}}],
{c, -0.5, 2, 0.2}]

Bob Hanlon

On Wed, Jun 13, 2012 at 4:57 AM, Narasimham <mathma18 at hotmail.com> wrote:
> Same topic is continued. Thanks to Murray Eisenberg and Bob Hanlon
>
> All variables or a single variable are easily pocked out from sol[c_]
> list for plotting.
> But how to pick out two out of them for ParametricPlot  ( 2D) ?
>
> sol[c_] := {x[t], y[t], z[t]} /.
>  First[NDSolve[{y''[t] + Sin[y[t]/c] == 0, y' == 0,
>     y == 1/(1 + c), x'[t] == t, x == c^2,
>     z'[t] == 2 c x[t] - y[t], z == 2}, {x, y, z}, {t, -3, =
3}]]
> Manipulate[
>  Plot[Evaluate[sol[c]], {t, -3, 3}, PlotStyle -> {Red, Thick},
>  AspectRatio -> Automatic,
>  PlotRange -> {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
> Manipulate[
>  Plot[Evaluate[sol[c][]], {t, -3, 3}, PlotStyle -> {Red, Thick},
>  AspectRatio -> Automatic,
>  PlotRange -> {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
> " 2 parameter Dynamic manipulation not OK "
> Manipulate[
>  Plot[{Evaluate[sol[c][]], Evaluate[sol[c][]]}, {t, -3, 3},
>  PlotStyle -> {Green, Thick}, AspectRatio -> Automatic,
>  PlotRange -> {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
>
> Regards
> Narasimham
>

```

• Prev by Date: Re: ToString Awkwardness
• Next by Date: Graph plotting and "The precision of the argument function is less
• Previous by thread: Varying a constant in an ODE to Manipulate solution
• Next by thread: Re: Varying a constant in an ODE to Manipulate solution