Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Runge Kutta question, equation has dx/dt in it and non linear term ?

  1. Oct 23, 2014 #1
    How does one set up the Runge Kutta for

    [tex] \frac {d^2y} {dt} m = b(\frac {dy} {dt} - \frac {dx} {dt}) + k (y-x) [/tex] ?

    Set up the substitution variables:

    [tex] a = \frac {d^2y}{dt}[/tex]

    [tex] v = \frac{dy} {dt} [/tex]

    Then what ?

    Is there a way to get [tex] \frac{dx} {dt}[/tex] out of the equation ? If not, I have to differentiate my input function to provide values ? Can I do this by (x(t-1) + x(t+1))/ 2h or similar ?

    Does it matter if B(v) is non linear and I get the value from a look up table instead of being able to calculate it ?

    Thanks !
  2. jcsd
  3. Oct 23, 2014 #2


    User Avatar

    Staff: Mentor

    You need to treat ##dx/dt## as you did ##dy/dt##, and introduce a new variable for it. Also, you do not make the substitution ##a = d^2y/dt^2##, as then you lose the derivative!

    What you need to do is set
    a_1 &= x \\
    a_2 &= y \\
    a_3 &= \frac{dx}{dt} \\
    a_4 &= \frac{dy}{dt}

    I'll let you set up the system of ode's using that.

    It doesn't matter, so long as you can provide a value whatever the input given.
  4. Oct 23, 2014 #3
    I understand the theory behind RK, but I'm stuck trying to figure out the logic for doing the substitutions and how to set up the equations.

    I'm trying to follow the example in this http://epublications.bond.edu.au/cgi/viewcontent.cgi?article=1130&context=ejsie

    The author's example doesn't have the dx/dt term. He has one new variable be the derivative of the other.

    Here is what I get with your suggestion.

    [tex] \frac {da_4}{dt} - \frac {b}{m}(a_4-a_3) - \frac {K}{m}(a_2 - a_1) = 0 [/tex]
    [tex] \frac {da_2}{dt} = a_4 [/tex]

    I get it now. I can take it from here. Thanks for your help !
    Last edited: Oct 23, 2014
  5. Oct 23, 2014 #4


    User Avatar

    Staff: Mentor

    You need three more equations, as you need one for each ##a##.
  6. Oct 23, 2014 #5
    [tex] \frac {dy}{dt} = v [/tex]
    [tex] \frac {dv}{dt} = \frac {b}{m} (v- \frac {dx}{dt}) + \frac {K}{m}(y - x)[/tex]
  7. Oct 23, 2014 #6


    User Avatar

    Staff: Mentor

    You still have ##dx/dt## that needs to be replaced by a variable. That will give you an equation for ##a_1## (using my notation above). Then there is the question of ##da_3/dt = d^2x/dt^2##. You may set that to 0, depending on the actual physical problem you are considering.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook