Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2006-12-24 11:58:05

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

runge kutta numerical integration

taking from wikipedia:

Let an initial value problem be specified as follows.






(h being the time step)

the thing is, i dont get how i can use this;

for example, a simple system like this, nevermind having the second derivitave a function of x aswell.


how would i apply the rk4 method to this for integrating for

and x?

Last edited by luca-deltodesco (2006-12-24 11:58:34)


The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

#2 2006-12-24 16:35:52

George,Y
Member
Registered: 2006-03-12
Posts: 1,379

Re: runge kutta numerical integration

Runge Kutta is actually not for a system but for an implicit derivative, luca.
To apply it, you have to write explicitly

Last edited by George,Y (2006-12-24 16:37:35)


X'(y-Xβ)=0

Offline

#3 2006-12-24 20:44:22

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

Re: runge kutta numerical integration

any ideas how i might convert to such? Im learning about rigid body physics, rotational velocity etc, and they all give a set of first order differential equations like those two, and say they are now in the form needed for the runge kutta

http://www.myphysicslab.com/collision.html

look under the title numerical simulation, ignore what it actually on the right side, they are just the forces for the simulation it shows above, but just in general, it has them in the form of the two i gave above.

actually, is not meant to be interpreted like this for a system, that rather than y being a single variable, y is just all the state variables being integrated for, and then ofcourse

is just all the initial differentials which i can calculate above as just being -kvx and vx, there current values for the differentials for x and vx, and then do this for the others.

so in this example, lets say:









is that not a perfectly okay way of doing it?

if i integrate exactly, (rearranging the equation with velocity)


which looks as though doing the rk4 like that is fine.


so that basicly,

given the state variables, and a known intial value for all states


and, a 'vector' of differential functions
such that

then you have





Last edited by luca-deltodesco (2006-12-24 20:55:48)


The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

#4 2006-12-24 21:46:00

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

Re: runge kutta numerical integration

infact, ive tested this in a program, over a period of 50 seconds, using the same equations

and after 50 seconds the value of x diverges only 5.03 and the value of vx diverges only -0.4 from the exact values

Last edited by luca-deltodesco (2006-12-24 21:46:36)


The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

Board footer

Powered by FluxBB