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

Mathematica: NDSolve in 2D

  1. Mar 13, 2012 #1

    I am succesfully using NDSolve to find the solution of a 1D equation of motion:
    Code (Text):

    solution = NDSolve[{x''[t] == -200, x[0] == 0, x'[0] == 100}, x, {t, 0, 1}];
    ParametricPlot[{x[t], x'[t]} /. solution, {t, 0, 1}, PlotRange -> {{0, 100}, {0, 100}}]
    This is a particle decelerating constantly in the x-direction. Now, I need to extend my problem, because the deceleration along x is actually not constant. It depends on both the x- and y-coordinate of the particle.

    So the total problem is
    \frac{d^2x}{dt^2} = -200y - x\\
    \frac{dy}{dt} = -2
    So along x there is non-constant deceleration, and along y I have a constant velocity. Is it possible to solve such a problem in Mathematica?

    Best regards and thanks in advance,
    Last edited: Mar 13, 2012
  2. jcsd
  3. Mar 13, 2012 #2


    User Avatar
    Science Advisor


    Code (Text):

    solution =
     NDSolve[{x''[t] == -200 y[t] - x[t], y'[t] == -2, x[0] == 0,
       x'[0] == 100, y[0] == 0}, {x[t], y[t]}, {t, 0, 1}]
  4. Mar 14, 2012 #3
    Thanks, that is kind of you. NDSolve is a pretty powerful tool.

    The initial condition y'(0) is something that changes for different problems. However, my particle is not allowed to move further than y=5. If it does so, then it is "lost", and its solution is not relevant to my problem any longer. Is there a way to incorporate this into NDSolve, i.e. that it should stop calculating further if y(t) == 5?

    Best regards,
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook