# Numerically solving position and velocity of a particle

1. Nov 1, 2013

### cytochrome

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. Nov 1, 2013

### dipole

Same way you would by hand - integrate it. From calculus you know that,

$$x(t) = \int_{t_0}^t v(\xi) d\xi$$

You can do this quite accurately numerically using Gaussian Quadrature.

3. Nov 1, 2013

### SteamKing

Staff Emeritus
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.