Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

NDSolve in Mathematica

  1. Feb 17, 2012 #1
    Hi

    Say I solve the following differential equation in Mathematica:
    Code (Text):

    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]?

    Best regards,
    Niles.
     
  2. jcsd
  3. Feb 17, 2012 #2

    kai_sikorski

    User Avatar
    Gold Member

    ParametricPlot[Evaluate[{y[x], y''[x]} /. s], {x, 0, 30}]
     
  4. Feb 18, 2012 #3
    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?

    Best,
    Niles.
     
  5. Feb 18, 2012 #4
    PlotRange -> {{0, 10}, {0, 5}} works. Thanks!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: NDSolve in Mathematica
  1. Mathematica NDSolve (Replies: 1)

  2. Mathematica NDSolve (Replies: 27)

Loading...