RE: NDolve + ParametricPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg67556] RE: [mg67513] NDolve + ParametricPlot
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 30 Jun 2006 04:15:19 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Paolo,
It is easier to actually define your x function.
Clear[x]
sol = NDSolve[{x''[t] == x[t], x[0] == 1, x'[0] == 1.1}, x, {t, 0, 3}];
x[t_] = x[t] /. First@sol
InterpolatingFunction[{{0., 3.}}, <>][t]
ParametricPlot[{x[t], x'[t]}, {t, 0, 3}];
Generally it is best to manipulate and define the expression you are going
to plot outside of any plot statement. For one thing you can see what you
are actually dealing. Then plug the final result into the plot statement.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Paolo Pani [mailto:paolopani at RIMUOVEREgmail.com]
To: mathgroup at smc.vnet.net
Hi, i'm new with Mathematica..i'm getting mad with expressions like this:
sol = NDSolve[{x''[t] == x[t], x[0] == 1, x'[0] == 1.1}, x, {t, 0, 3}];
Plot[x[t] /. sol, {t, 0, 3}];
Plot[D[x[t]] /. sol, {t, 0, 3}];
ParametricPlot[Evaluate[{x[t] /. sol, D[x[t] /. sol]}], {t, 0, 3}];
The first two Plots are ok, the third give me:
ParametricPlot::pptr: {InterpolatingFunction[{{0., 3.}}, {2, 2, True,
Real, \
{3}, {0}}, {{\[LeftSkeleton]1\[RightSkeleton]}}, {{0, 3, 6, 9, 12, 15, 18, \
21, 24, 27, \[LeftSkeleton]32\[RightSkeleton]}, {1., 1.1, \[LeftSkeleton]8\
\[RightSkeleton], \[LeftSkeleton]113\[RightSkeleton]}}, {Automatic}][t]}
does \
not evaluate to a pair of real numbers at t = 1.25`*^-7.
... and "More..." does tell nothing more.
Where is my mistake?
Thanks and sorry for my bad english
Paolo