#### Archived

This topic is now archived and is closed to further replies.

# Need some help with Runge-Kutta !

This topic is 5802 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello Everyone, I''m currently writing a phyics-simulator and have been using the Euler-Method for all integrations so far. But I would like to implement the Runge-Kutta for the higher accuracy and larger stepsizes one can take with it, but I''m not quite sure about how to implement it. The general equations are as follows, actually looks quite simple: k1 = h * f(x, y) k2 = h * f(x + h/2, y + k1/2) k3 = h * f(x + h/2, y + k2/2) k4 = h * f(x + h, y + k3) y+1 = y + (k1 + 2k2 + 2k3 + k4) / 6 ... I want to use the following basic equations for the movement of some particle: x'' = V //Velocity from previous timestep v'' = Forces / Mass ...but in the runge-kutta algorithm the function f(x,y) is called with two parameters, that get adjusted during the intermediate steps k2, k3, k4. But in my first equation there is only one paremeter (velocity), do I just ignore one of the parameters and if yes which one do I use (the first or second - since they are different)? In the second equation both ''Forces'' and ''Mass'' would probably not be given as parameters to the function - or should they? And since I have two functions, do I just do two seperate runge-kuttas or do I combine them somehow? I found many examples on the net about runge-kutta, but none describing simple movement using two equations... but this must be the most common case... I would be grateful for any help - these equations are driving me crazy........ B.

##### Share on other sites
I''m assuming this is a one dimensional particle motion problem you''re talking about. In Runge-Kutta the easiest way to look at it as that the y is the dependent variable in the problem. So in a one dimensional particle motion problem you''re really dealing with t and x, rather than x and y. Where t becomes the x and x becomes the y.

There are cases where the function does not actually depend on the dependent variable, and that degenerates into Simpson''s method.

For the rest of your questions the answer would depend on what your equations actually look like. How does your force vary with position and time?

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 17
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632660
• Total Posts
3007697
• ### Who's Online (See full list)

There are no registered users currently online

×