Runge-Kutta Method for a double pendulum

vendredi 29 novembre 2013

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.



1. The problem statement, all variables and given/known data



I have the equations of motion: d(omega)/dt and d(theta)/dt = omega





2. Relevant equations



The Runge-Kutta method can be found here: http://en.wikipedia.org/wiki/Runge%E...3Kutta_methods



3. The attempt at a solution



for omega I tried the following:

k1=d(omega)/dt

k2=d(omega)/dt + 0.5*dt*k1

k3=d(omega)/dt + 0.5*dt*k2

k4=d(omega)/dt + 0.5*dt*k3



omega= omega_initial + (1/6)*dt*(k1 + 2*k2 + 2*k3 + k4)



and for theta:

k1=omega

k2=omega + 0.5*dt*k1

k3=omega + 0.5*dt*k2

k4=omega + 0.5*dt*k3



theta = theta_initial + (1/6)*dt*(k1 + 2*k2 + 2*k3 + k4)






via Physics Forums RSS Feed http://www.physicsforums.com/showthread.php?t=725578&goto=newpost

0 commentaires:

Enregistrer un commentaire