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

  • Thread starter Thread starter Niles
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion focuses on solving a differential equation using Mathematica and plotting the results. The user successfully solves the equation and plots the functions y[x], y'[x], and y''[x] against x. They inquire about plotting y''[x] against y[x], to which another user suggests using ParametricPlot. The original poster then raises a concern about adjusting the PlotRange independently for x and y in a parametric plot. They find that using PlotRange -> {{0, 10}, {0, 5}} effectively allows for independent control of the ranges for both axes.
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.
 
Physics news 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!
 

Similar threads

Replies
1
Views
2K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
4
Views
3K
Back
Top