Package com.titan.math.solver
Class AdamsBashforth2ndOrderSolver
java.lang.Object
com.titan.math.solver.AdamsBashforth2ndOrderSolver
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetIsFirstIteration(boolean isFirstIteration) sets the isFirstIteration variable to a specified boolean valuevoidsetPreviousState(Vector[] state) sets the previous state to a specified state vectorVector[]takes one step forward and calculates the state of the solar system using the Adams-Bashforth 2nd order method
-
Constructor Details
-
AdamsBashforth2ndOrderSolver
public AdamsBashforth2ndOrderSolver()
-
-
Method Details
-
setIsFirstIteration
public void setIsFirstIteration(boolean isFirstIteration) sets the isFirstIteration variable to a specified boolean value- Parameters:
isFirstIteration- boolean value for the isFirstIteration
-
setPreviousState
sets the previous state to a specified state vector- Parameters:
state- a vector of the state of a celestial object, consisting its positions and velocities
-
solve
public Vector[] solve(Function f, Vector positions, Vector velocities, Vector masses, double h, double t) takes one step forward and calculates the state of the solar system using the Adams-Bashforth 2nd order method- Specified by:
solvein interfaceSolver- Parameters:
f-Functionthat is used to estimate the next steppositions- positions of celestial bodies in the systemvelocities- velocities of celestial bodies in the systemmasses- masses of celestial bodies in the systemh- step-sizet- time step we are currently on- Returns:
- returns the state of the system after one step
-