Package com.titan.math.solver
Class RungeKuttaSolver
java.lang.Object
com.titan.math.solver.RungeKuttaSolver
- All Implemented Interfaces:
Solver
RungeKuttaSolver implements Solver:
implementation of the Runge-Kutta-Solver approximation method
k1 = h * f(wi, ti);
k2 = h * f(wi + k1, ti + h/2);
k3 = h * f(wi + k2, ti + h/2);
k4 = h * f(wi + k3, ti);
wi+1 = wi + 1/6 * (k1 + 2*k2 + 2*k3 + k4)
implementation of the Runge-Kutta-Solver approximation method
k1 = h * f(wi, ti);
k2 = h * f(wi + k1, ti + h/2);
k3 = h * f(wi + k2, ti + h/2);
k4 = h * f(wi + k3, ti);
wi+1 = wi + 1/6 * (k1 + 2*k2 + 2*k3 + k4)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
RungeKuttaSolver
public RungeKuttaSolver()
-
-
Method Details
-
solve
public Vector[] solve(Function f, Vector positions, Vector velocities, Vector masses, double h, double t) this method calculates the positions and velocities of all celestial objects after every iteration using the 4 stage Runge-Kutta method- Specified by:
solve
in interfaceSolver
- Parameters:
f
-Function
that is used to estimate the next steppositions
- vector of all the positionsvelocities
- vector of all the velocitiesmasses
- masses (used like this in the instances of this interface)h
- step-sizet
- step we are currently on- Returns:
- resulting Vector of the function
-