2
$\begingroup$

Although I've been looking everywhere, I have been unable to find an answer to my question so here it is. For a driven damped pendulum the equation of motion in dimensionless units is,

$$\alpha(\omega,\theta,t)=-c\ \omega -\sin \theta +F(t).$$

My question is obtaining my next step $\omega(t + \Delta t)$. I know what to do for time $t$ and $\omega$, but not for $\theta$. The fourth order RK method can be found pretty much anywhere

$$\omega(t+ \Delta t) = \omega(t) + (k_1 +2k_2 +2k_3 + k_4)*\Delta t/6, $$

and I am specifically confused on what to enter for $\theta$ in the $k_1, k_2$. . . calculations. The first one is easy but I'm unsure on the rest:

$$k_1 = \alpha(\omega(t),\ \theta(t),\ t) \\ k_2=\alpha(\omega(t) + k_1\Delta t/2,\ \theta(t) + \ ???,\ t +\Delta t/2) \\ k_3=\alpha(\omega(t) + k_2\Delta t/2,\ \theta(t) + \ ???,\ t +\Delta t/2) \\ k_4=\alpha(\omega(t) + k_3\Delta t,\ \theta(t) + \ ???,\ t +\Delta t).$$

From here solving for the next $\theta(t+\Delta t)$ is simple enough I just need help knowing what to do the above equation. It seems like all the examples that I've seen show examples for only two variables and not three.

$\endgroup$
4
  • 2
    $\begingroup$ You need to write your system as a first order one first. That's the first step, check the Wikipedia article, they start from there. In your case, you have a second derivative in the left hand side. $\endgroup$
    – nicoguaro
    Commented May 1, 2017 at 23:09
  • $\begingroup$ As @nicoguaro mentions, you have not yet represented your problem as a system of 1st order Ordinary Differential Equations. Once you do that, you just view Runge-Kutta formula in a vector sense and it will be clear what you need to do. $\endgroup$
    – spektr
    Commented May 1, 2017 at 23:51
  • $\begingroup$ I'm still not sure how this would help @nicoguaro. Letting $\omega = y $ and $\theta = x$, then I get two equations of motion, $\dot x = y$ and $\dot y = -cy - \sin x + F(t)$. The second equation is still a function of $y, x,$ and $t$ so I'm not sure how this helps. The Wikipedia and everywhere else starts with a function of only two variables, which is why I need help with the above example. $\endgroup$
    – Josh
    Commented May 2, 2017 at 1:36
  • 2
    $\begingroup$ Then you write it down in vector form $$\mathbf{x}' = \begin{bmatrix}x_2\\ -cx_2 - \sin x_1 + F(t)\end{bmatrix}$$ and apply the iteration considering the vector form of your equation. $\endgroup$
    – nicoguaro
    Commented May 2, 2017 at 1:38

1 Answer 1

3
$\begingroup$

Let's define $\boldsymbol{u} = [\theta, \omega ]^{T} = [u_1, u_2]^{T}$. The system of differential equations to solve can then be represented as:

\begin{align} \dot{\boldsymbol{u}} = f(t,\boldsymbol{u}) = \begin{bmatrix} u_2 \\ -c u_2 - \sin(u_1) + F(t)\end{bmatrix} \end{align}

Thus, the resulting Runge-Kutta formulation is:

\begin{align} \boldsymbol{k}_1 &= f\left(t_k, \boldsymbol{u}_k\right) \\ % \boldsymbol{k}_2 &= f\left(t_k + \frac{\Delta t}{2}, \boldsymbol{u}_k + \frac{\Delta t}{2} \boldsymbol{k}_1\right) \\ % \boldsymbol{k}_3 &= f\left(t_k + \frac{\Delta t}{2}, \boldsymbol{u}_k + \frac{\Delta t}{2} \boldsymbol{k}_2\right) \\ % \boldsymbol{k}_4 &= f\left(t_k + \Delta t, \boldsymbol{u}_k + \Delta t \boldsymbol{k}_3\right) \\ % \boldsymbol{u}_{k+1} &= \boldsymbol{u}_k + \frac{\Delta t}{6}\left(\boldsymbol{k}_1 + 2\boldsymbol{k}_2 + 2\boldsymbol{k}_3 + \boldsymbol{k}_4\right) \end{align}

where $t_j = t_{0} + j\Delta t$ and $\boldsymbol{u}_j = \boldsymbol{u}(t_{j})$. As noted by nicoguaro, this is just the vector form of the Runge-Kutta equations. All it assumes is that your function $f(\cdot,\cdot)$ takes a vector input for the state you are integrating.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.