- #1
heycoa
- 75
- 0
Hello, I am trying to program a double pendulum via the 4th order Runge-Kutta method and I cannot seem to be getting the right output. At first I used the Euler-Cromer method, but now I am aiming to make it more accurate.
I have the equations of motion: d(omega)/dt and d(theta)/dt = omega
also, my step size is "h"
The Runge-Kutta method can be found here: http://en.wikipedia.org/wiki/Runge–Kutta_methods
for omega I tried the following:
k1=d(omega)/dt
k2=d(omega)/dt + 0.5*h*k1
k3=d(omega)/dt + 0.5*h*k2
k4=d(omega)/dt + 0.5*h*k3
omega= omega_initial + (1/6)*h*(k1 + 2*k2 + 2*k3 + k4)
and for theta:
k1=omega
k2=omega + 0.5*h*k1
k3=omega + 0.5*h*k2
k4=omega + 0.5*h*k3
theta = theta_initial + (1/6)*h*(k1 + 2*k2 + 2*k3 + k4)
Homework Statement
I have the equations of motion: d(omega)/dt and d(theta)/dt = omega
also, my step size is "h"
Homework Equations
The Runge-Kutta method can be found here: http://en.wikipedia.org/wiki/Runge–Kutta_methods
The Attempt at a Solution
for omega I tried the following:
k1=d(omega)/dt
k2=d(omega)/dt + 0.5*h*k1
k3=d(omega)/dt + 0.5*h*k2
k4=d(omega)/dt + 0.5*h*k3
omega= omega_initial + (1/6)*h*(k1 + 2*k2 + 2*k3 + k4)
and for theta:
k1=omega
k2=omega + 0.5*h*k1
k3=omega + 0.5*h*k2
k4=omega + 0.5*h*k3
theta = theta_initial + (1/6)*h*(k1 + 2*k2 + 2*k3 + k4)
Last edited: