FAQ Database Discussion Community


How can I solve this third order equation using the ODE45 function?

matlab,ode,differential-equations,runge-kutta
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)); ...

How to change object in for loop each time loop is run

c++,algorithm,for-loop,numerical-methods,runge-kutta
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...

Problems implementing Runge Kutta to solve a Damped Pendulum

vb.net,simulation,runge-kutta
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...

What are the coefficients of the end value for the Runge-Kutta 3 (RK3) method in python

python,time,runge-kutta
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 +...

RK4 giving wrong result

python,ode,runge-kutta
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...

Why am I receiving the error that I am multiplying by non-int type 'float'?

python,integer,numerical,runge-kutta
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...