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

1. Oct 23, 2014

### someguy23

How does one set up the Runge Kutta for

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

Set up the substitution variables:

$$a = \frac {d^2y}{dt}$$

$$v = \frac{dy} {dt}$$

Then what ?

Is there a way to get $$\frac{dx} {dt}$$ 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. Oct 23, 2014

### 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
\begin{align} a_1 &= x \\ a_2 &= y \\ a_3 &= \frac{dx}{dt} \\ a_4 &= \frac{dy}{dt} \end{align}

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.

3. Oct 23, 2014

### someguy23

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.

$$\frac {da_4}{dt} - \frac {b}{m}(a_4-a_3) - \frac {K}{m}(a_2 - a_1) = 0$$
$$\frac {da_2}{dt} = a_4$$

I get it now. I can take it from here. Thanks for your help !

Last edited: Oct 23, 2014
4. Oct 23, 2014

### Staff: Mentor

You need three more equations, as you need one for each $a$.

5. Oct 23, 2014

### someguy23

$$\frac {dy}{dt} = v$$
$$\frac {dv}{dt} = \frac {b}{m} (v- \frac {dx}{dt}) + \frac {K}{m}(y - x)$$

6. Oct 23, 2014

### 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.