1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Numerically solving position and velocity of a particle

  1. Nov 1, 2013 #1
    I have derived a 2nd order differential equation for the position of a particle. I can turn it into a first order ODE by making it an equation for the velocity of a particle, which is easy to solve. Once I have the velocity (which is a large data vector), what is the best way to numerically get the position?

    I am using Heun's method for solving the ODE, but I'm confused how to use it for a 2nd order ODE and how to get the velocity AND the position
  2. jcsd
  3. Nov 1, 2013 #2
    Same way you would by hand - integrate it. From calculus you know that,

    [tex] x(t) = \int_{t_0}^t v(\xi) d\xi [/tex]

    You can do this quite accurately numerically using Gaussian Quadrature.
  4. Nov 1, 2013 #3


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    You can convert your original 2nd order ODE into a system of 2 first order ODEs which can be solved with Heun or with one of the other numerical methods (Runge-Kutta, for example). This procedure is covered in standard texts on ODEs.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook