0

Suppose we have the following dynamic equation for acceleration

We can then apply any of several known numerical integration techniques to integrate the acceleration to compute future positions and velocities. Given initial conditions on the motion, usually in the form shown here , we integrate the dynamic equation for acceleration forward in time numerically by steps of size dt using Euler integration: Starting with t = 0, iteratively to compute the following , where, for each iteration, the dynamic equation for acceleration is computed to calculate the angular acceleration. How can we perform the Runge-Kutta 4th order method instead of Euler integration for this case?

Eng Eng
  • 21
  • What is it that you don't understand ? RK4 is straightforward. –  Jun 14 '21 at 19:54
  • @YvesDaoust but how to apply the RK4 for this particular case? I can surly use the RK4 to solve any other ordinary differential equation, but in fact, this case can is a little complicated, and I could not apply the RK4 for. – Eng Eng Jun 14 '21 at 19:58
  • 3
    If you can apply Euler, why can't you apply RK ? –  Jun 14 '21 at 20:04
  • 1
    See https://scicomp.stackexchange.com/questions/34257/solving-coupled-odes-using-runge-kutta-method and https://stackoverflow.com/questions/60405185/is-there-a-better-way-to-tidy-this-chuck-of-code-it-is-the-runge-kutta-4th-orde – Lutz Lehmann Jun 14 '21 at 20:04

1 Answers1

1

If you used Euler's method, you realized that your equations can be written on the form $$ \begin{cases}u_1' = u_2 \\ u_2' = f(t,u_1,u_2)\end{cases} $$

Denoting $U=(u_1,u_2)$ and $F(t,U) = (u_2, f(t,u_1,u_2)$, RK4 would be something like

\begin{align*} k_{1} = & F(t_n,U_n)\\ k_{2} = & F(t_n+\frac h2, U_n + \frac h2 k_{1})\\ k_{3} = & F(t_n+\frac h2, U_n + \frac h2 k_{2})\\ k_{4} = & F(t_n+h, U_n + h k_{3})\\ U_{n+1} = & U_n + \frac h6 (k_{1}+2k_{2} + 2k_{3} + k_{4}) \end{align*}

PierreCarre
  • 20,974
  • 1
  • 18
  • 34