1. Not finding help here? Sign up for a free 30min 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!

Second Order Runge Kutta for Simple Harmonic Motion

  1. Sep 22, 2016 #1
    1. The problem statement, all variables and given/known data
    The ordinary differential equation describing shm is
    d^2x/dt^2=-w^2x
    where x is the displacement, t is the time and w is the frequency. If x=0 at t=0, the analytical solution is x=Asin(wt), where A is the amplitude.

    1) Rewite equation 1 as two first oder ode's suitable for solution using Runge Kutta Methods
    2)Determine the second order runge-kutta solution for this system after the first time step h and show the leading error term in x(h) is proportional to h^3

    2. Relevant equations
    k1=hf(xn,yn)
    k2=hf(x+h, y+k1)
    y_(n+1)=y_n+(1/2)k_1+(1/2)k_2


    3. The attempt at a solution
    I have completed part 1 and got dx/dt=v and dv/dt=-w^2x but I am unsure how to proceed. The lecturer didn't do a great job of explaining the method and I don't know how to do it when you have two equations and are not given the step size.
     
  2. jcsd
  3. Sep 22, 2016 #2

    DrClaude

    User Avatar

    Staff: Mentor

    The relate what you got and the equations of the Runge-Kutta algorithm, set ##y_1 \equiv x## and ##y_2 \equiv v##, and remember that
    $$
    \frac{d y_n}{dt} = f_n
    $$
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted