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!

Homework Help: Solving the Kinematic Equations using Runge-Kutta

  1. Jul 8, 2011 #1
    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!
    thanks in advance
    Last edited: Jul 8, 2011
  2. jcsd
  3. Jul 8, 2011 #2

    Filip Larsen

    User Avatar
    Gold Member

    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
  4. Jul 8, 2011 #3


    User Avatar
    Science Advisor

    What language are you going to be working in?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook