This question already has an answer here:

Manipulate not showing anything

1 answer

I want to plot the parametric diagram of {y[t],z[t]}, in which I manipulate a parameter, ω, from [1,10π][1,10π][1, 10 \pi]. Here is what I have attempted, but I can’t get a plot. I think there is something wrong with my Manipulate expression.

Can anyone give me some advice?

Remove[“Global`*”]

dieff = {y”[t] == ω z'[t],

z”[t] == -ω y'[t] + ω E1/B};

inicond = {y[0] == y'[0] == z[0] == z'[0] == 0};

eqnlist = Join[dieff, inicond];

soln = DSolve[eqnlist, {y[t], z[t]}, t][[1]];

E1 = B = 1;

Print[“y[t] = “, y[t] /. soln]

Print[“z[t] = “, z[t] /. soln]

Manipulate[ParametricPlot[ {y[t], z[t]} /. soln, {t, 0, 2}], {ω, 0, 10 π}]

=================

=================

3 Answers

3

=================

I post for insights into ωω\omega bounds:

fun[w_] := {y[t], z[t]} /.

First@DSolve[{y”[t] == w z'[t], z”[t] == -w y'[t] + w ,

y[0] == y'[0] == z[0] == z'[0] == 0}, {y[t], z[t]}, t]

Manipulate[

Column[{ParametricPlot[Evaluate[fun[w] /. t -> u], {u, 0, 2},

PlotRange -> {{-1.5, 1.5}, {0, 2}}, Frame -> True,

FrameLabel -> TraditionalForm /@ {y[t], z[t]}],

Plot[Evaluate[fun[w] /. t -> u], {u, 0, 2},

PlotStyle -> {Red, Blue}, PlotRange -> {-2, 2},

PlotLegends -> TraditionalForm /@ {y[t], z[t]}]}], {{w, 0,

“\[Omega]”}, 0, 2 Pi}]

+1 ubpdqn, you make the neatest animated examples that always further illuminate the question at hand!

– ciao

Mar 6 ’14 at 10:47

@rasher thank you for the kind words…just thought important to notice solution blows out as ωω\omega passes around 2π2π2\pi

– ubpdqn

Mar 6 ’14 at 10:57

Try changing Manipulate to

With[{f1 = y[t] /. soln, f2 = z[t] /. soln},

Manipulate[ParametricPlot[{f1, f2}, {t, 0, 2}], {ω, 0.1, 10 π}]]

Note also change to omega lower bound – you had division by zero with current example.

It works! But I think yours is essentially the same as mine;yet, mine wouldn’t work. I’m confused.

– Lawerance

Mar 6 ’14 at 0:09

@Lawerance: There’s several ways to accomplish same thing, but while yours may look the same basically, what happens within Manipulate causes different outcome. See the documentation re: Manipulate, and the hows/whys of evaluation using it. There’s a good tutorial overview as part of the documentation.

– ciao

Mar 6 ’14 at 0:12

Another solution :

Manipulate[

ParametricPlot[soln[[All, 2]] /.ω -> s, {t, 0, 2},

PlotRange -> {{0, 3}, {0, 2}}], {s, $MachineEpsilon, 10 π}]