When I convert the third order ODE into a system of first order ODEs, I got this: x1' = x2; x2' = x3; x3' = R1*x1+R2*x2-alpha*x3; x4' = 1; where x4 = t; R1 = -0.000001*(1-cos(theta*x4))-theta*sin(theta*x4)+1; R2 = -(1-cos(theta*x4)); ...

I'm trying to keep the detail to the minimum of what is relevant in this question, but I'll certainly expand on anything that makes my post clearer. I'm pretty new to C++ so forgive me for what's perhaps an obvious question, I couldn't even articulate the problem well enough to...

I am a high school student working on a "home project" to animate a damped pendulum by solving differential equations using the Runge Kutta method. (The equations can be seen here: http://www.maths.tcd.ie/~smurray/Pendulumwriteup.pdf) I have been informed that in my code, my implementation of RK4 is not correct, and to be...

Sorry if I have worded this question badly, maybe if someone can suggest better phrasing and I will change accordingly. So, In terms of RK4, timestepping with x_old as initial x value for a time t, we have; x_new = x_old + (1.0/6) * dt * (k1 + 2*k2 +...

I'm trying to numerically solve a simple second order DE x'' = -x. I used a new variable x'=v, so I have two equations. While it seems simple, it somehow produces a result that's really far of the correct result. def f(x): return -x def rk4(f=f,h=2*pi/100,x0=1,v0=0,t0=0,n=100): '''RK4''' v=[v0] x=[x0] for...

I am having problems with my code which is a Runge Kutta algorithm to numerically solve for a harmonic oscillator. Unfortunately, I am receiving an error that says I can't multiply sequence by non-int of type float. Considering this code is nearly verbatim from an educational text, I cannot see...