# Solving the Kinematic Equations using Runge-Kutta

1. Jul 8, 2011

### livenail

1. The problem statement, all variables and given/known data
I am attempting to write a physics simulation program using the kinematic equations and using Runge-Kutta to solve them to determine how an object will move through space subject to certain gravitational forces etc.

2. Relevant equations
I have x=vt+(at^2)/2 as the equation i need to solve.
Same in the Y direction.

3. The attempt at a solution
I've attempted to find code online to help, but what i've found has been mostly the spring equations, nothing dealing with pure kinematics.
If someone knows of a place i could get code for this, in any language it would be much appreciated!

Last edited: Jul 8, 2011
2. Jul 8, 2011

### Filip Larsen

In general you need to transform your problem into a set of first order ordinary differential equations with one equation for each independent state variable. Assuming you want to calculate your trajectory in 2D you would then have 4 state variables (the 2 position components x and y, and the 2 velocity components u and w) and the equations for constant acceleration ax and ay would then be something like du/dt = ax, dw/dt = ay, dx/dt = u, dy/dt = w.

Having a set of first order ODE's you can start applying a numerical method to solve it [1], like Runge-Kutta [2].

[1] http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations
[2] http://en.wikipedia.org/wiki/Runge–Kutta_methods

3. Jul 8, 2011

### uart

What language are you going to be working in?