net.java.dev.joode.stepper
Class RungeKuttaOrder4Stepper
java.lang.Object
net.java.dev.joode.stepper.RungeKuttaOrder4Stepper
- All Implemented Interfaces:
- StepperFunction
public class RungeKuttaOrder4Stepper
- extends java.lang.Object
- implements StepperFunction
Steps the world forward in time using the Runge-Kutter order four intergration
This calls the LCP algorithm 4 times, but produces very accurate results, so calling it with large stepsizes
is exceptable.
Error of order h^5
Formula is
k1 = hf(x0, t0)
k2 = hf(x0+k1/2, t0 + h/2)
k3 = hf(x0+k2/2, t0 + h/2)
k4 = hf(x0+k3, t0+h)
x(t0+h) = x0 + k1/6 + k2/3 + k3/3 + k4/6
OR
xn+1 = xn + h/6 (a + 2 b + 2 c + d)
where
a = f (0 , xn)
b = f (h/2, xn + h/2 a)
c = f (h/2, xn + h/2 b)
d = f (h, xn + h c)
k1 is the slope at the beginning of the interval;
k2 is the slope at the midpoint of the interval, using slope k1 to determine the value of y at the point tn + h/2 using Euler's method;
k3 is again the slope at the midpoint, but now using the slope k2 to determine the y-value;
k4 is the slope at the end of the interval, with its y-value determined using k3.
- Author:
- Tom Larkworthy
|
Method Summary |
void |
step(World world,
Body[] body,
int nb,
Joint[] joint,
int nj,
float stepsize)
steps the ISLAND of bodies one step using the mid point method |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REPORT_ERROR
public static final boolean REPORT_ERROR
- See Also:
- Constant Field Values
INSTANCE
public static final RungeKuttaOrder4Stepper INSTANCE
STEP_SIZE
public static float STEP_SIZE
- the small step size that the stepper uses to estimate the acceleration curve at a
point in time
Jinfo
public static final Joint.Info2 Jinfo
step
public void step(World world,
Body[] body,
int nb,
Joint[] joint,
int nj,
float stepsize)
- steps the ISLAND of bodies one step using the mid point method
- Specified by:
step in interface StepperFunction