Runge-Kutta fourth order

Discussion about everything. New games, 3d math, development tips...
Post Reply
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Runge-Kutta fourth order

Post by stefbuet »

Hey,
does anyone have a good link/book about the Runge-Kutta method demontration? (numeric approximation of solution of ordinary differencial equation)
I would like to start from the Taylor 5th order developpement to the final system of 21 equations to get 4 factors a1,a2,a3 and a4 used commonly. (which 1,2,2,1 is a solution)
I've found pretty much links about second order runge kutta method (which lead to euler method and middle point method), which is not that hard to understand, but I failed at doing it myself for the RK4... I guess it's a long demonstration to get those 21 equations.
Anyone can help?
Thanks a lot,
Stef.
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Ok, I found how to demonstrate fourth order runga kutta method starting from the generic runge kutta formula:
Image
Image
You get the final runge kutta approximation (sum it) and approximate it with the taylor formula, then develope the initial funtion y with taylor expression to fifth order and finaly find all factors by identification.
That's a pretty long demonstration to get all factors... I did it only for second order, but fouth would be like 10 pages, but I'll do it! :p
fmx

Post by fmx »

stefbuet wrote:
fmx wrote:No, the physics are generally very stable, otherwise you would see the vertices exploding everything and the ponytails would disappear totally.
...
The most popular physics engines use eular integration internally, there are ways to improve on the 1st order inaccuracies
most popular engines are using euler ?
Are you sure ? I thought they were using RK4.
I'm currently developping a small physic engine and I've been working on the runge kutta fourth order math demonstration (as it's a school project which have to be pushished on paper) for 1 week . :evil:
NO I am not absolutely sure about all the common physics engines using Eular :oops:
But I know Newton uses traditional Eular.

As long as the timesteps are small and relatively constant (eg, by fixing the physics at 60FPS updates) then even eular can give reasonable results

I used Position-Verlet integration in my FlagSceneNode because its cheap, simple and insanely accurate (fourth order accuracy).
But it FAILS at collision response so is unsuitable for anything more complex than non colliding cloth effects.

For other purposes I use Newton-Stormer-Verlet method which is a modified Eular integration method which I hinted at earlier.
It was explained here by John Schultz
http://www.gamedev.net/community/forums ... ID=2536863
The whole discussion is a good read

RK4 is a tad overkill for the requirements of physics in most games.
An implementation of it is explained here:
http://stackoverflow.com/questions/1668 ... me-physics


It all boils down to the performance you want out of your physics engine.
You can be as accurate as you like, but it if it wont allow an application or game to run with negligible difference in framerates then clearly that is an issue

But if you are only doing it for academic purposes, then it doesn't matter:
just go with RK4 since you have started on it :wink:
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Thanks for this nice response.
Lol the verlet integration looks so simple compared to runge-kunta even 2° order. I'll try to look at differences between those two. But as you said it, it's purly an academic project, I'll probably never use this physic engine later as we have so much better engines, free to use...
Now if verlet has less error than RK2, maybe I'll choose it. In fact RK4 is cool but my paper is limited to 20 pages, so the demonstration won't fit with everything else :P
Post Reply