Context: I'm trying to plot a phase-space orbit. After struggling for a good long while, I realized that I could solve the x differential equation analytically, rather than relying on NDSolve, and was able to plot the orbit. But I'm still wondering why the output of NDSolve wouldn't work in ParametricPlot even though it did in Plot. Hence, pretending I can't solve the equation analytically....
The equation for my p-axis (i.e. the y-axis) is just a linear equation in t, -m*g*t
. I used NDSolve to get the equation for my x-axis.
xA = NDSolve[{a'[t]== l*g*t^2 - (g + 2*l*pA/m)*t + (pA/m + l*pA^2/m^2/g), a[0] == .1},
a, {t, 0, 15}]
I can plot xA
versus time in Plot.
Plot[{a[t] /. xA}, {t, 0, .5}]
(I get the same graph if I replace a[t] /. xA
with the analytic solution).
However, when I try to do
ParametricPlot[{a[t] /. xA, -m*g*t}, {t, 0, .5}]
I get nothin' but a blank graph. (Whereas I get a curve if I replace a[t] /. xA
with the analytic solution.)
Why can't ParametricPlot figure it out when Plot is on top of the game? How can you use the results of NDSolve in ParametricPlot?
xA
is a list, you need to extract the first part:ParametricPlot[{a[t] /. xA[[1]], -m*g*t}, {t, 0, .5}]
$\endgroup$