Plotting y''[x] vs. y[x] in Mathematica with NDSolve

  • Context: Mathematica 
  • Thread starter Thread starter Niles
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 3K views
Niles
Messages
1,834
Reaction score
0
Hi

Say I solve the following differential equation in Mathematica:
Code:
s = NDSolve[{y''[x] + Sin[y[x]] y[x] == 0, y[0] == 1, y'[0] == 0}, y, {x, 0, 30}]
Plot[Evaluate[{y[x], y'[x], y''[x]} /. s], {x, 0, 30}, PlotStyle -> Automatic]
The last line plots the solutions vs. x, but how can I plot e.g. y''[x] vs. y[x]?


Niles.
 
on Phys.org
ParametricPlot[Evaluate[{y[x], y''[x]} /. s], {x, 0, 30}]
 
Hi

Thanks for that. Whenever I try and alter the PlotRange, it changes both x and y. I guess that is reasonable, since it is a parametric plot. But is there any way for me to determine the range of x and y independently?Niles.
 
PlotRange -> {{0, 10}, {0, 5}} works. Thanks!