ostk.astrodynamics.trajectory.state.NumericalSolver¶
- class NumericalSolver(
- self: ostk.astrodynamics.trajectory.state.NumericalSolver,
- log_type: ostk.mathematics.solver.NumericalSolver.LogType,
- stepper_type: ostk.mathematics.solver.NumericalSolver.StepperType,
- time_step: ostk.core.type.Real,
- relative_tolerance: ostk.core.type.Real,
- absolute_tolerance: ostk.core.type.Real,
- root_solver: ostk.astrodynamics.RootSolver = RootSolver.default(),
- log_type: ostk.mathematics.solver.NumericalSolver.LogType,
Bases:
NumericalSolverA numerical solver is used to integrate the trajectory of a dynamical system.
The numerical solver can be used to integrate the trajectory of a dynamical system to a given instant, or to a set of instants, or until an Event Condition is met.
Constructor.
- Parameters:
log_type (NumericalSolver.LogType) -- The type of logging.
stepper_type (NumericalSolver.StepperType) -- The type of stepper.
time_step (float) -- The time step.
relative_tolerance (float) -- The relative tolerance.
absolute_tolerance (float) -- The absolute tolerance.
root_solver (RootSolver, optional) -- The root solver. Defaults to RootSolver.Default().
Methods
Return a conditional numerical solver.
Return the default numerical solver.
Return the default conditional numerical solver.
Return a Numerical Solver using a fixed stepper.
Get the absolute tolerance of the solver.
Get the log type of the solver.
Get the observed state vectors from the last integration.
Get the observed states.
Get the relative tolerance of the solver.
Get the root solver.
Get the stepper type of the solver.
Get the time step of the solver.
Overloaded function.
Overloaded function.
Check if the numerical solver is defined.
Get string representation of a log type.
Get string representation of a stepper type.
Return an undefined numerical solver.
- class ConditionSolution¶
Bases:
pybind11_objectThe solution to an event condition.
- property condition_is_satisfied¶
Whether the event condition is satisfied.
- Type:
bool
- property iteration_count¶
The number of iterations required to find the solution.
- Type:
int
- property root_solver_has_converged¶
Whether the root solver has converged.
- Type:
bool
- property state¶
The state of the trajectory.
- Type:
State
- class LogType(
- self: ostk.mathematics.solver.NumericalSolver.LogType,
- value: int,
Bases:
pybind11_objectMembers:
NoLog
LogConstant
LogAdaptive
- property name¶
- class StepperType(
- self: ostk.mathematics.solver.NumericalSolver.StepperType,
- value: int,
Bases:
pybind11_objectMembers:
RungeKutta4
RungeKuttaCashKarp54
RungeKuttaFehlberg78
RungeKuttaDopri5
- property name¶
- static conditional(
- arg0: ostk.core.type.Real,
- arg1: ostk.core.type.Real,
- arg2: ostk.core.type.Real,
- arg3: Callable[[ostk.astrodynamics.trajectory.State], None],
- arg1: ostk.core.type.Real,
Return a conditional numerical solver.
- Returns:
The conditional numerical solver.
- Return type:
- static default() ostk.astrodynamics.trajectory.state.NumericalSolver¶
Return the default numerical solver.
- Returns:
The default numerical solver.
- Return type:
- static default_conditional(
- state_logger: Callable[[ostk.astrodynamics.trajectory.State], None] = None,
Return the default conditional numerical solver.
- Parameters:
state_logger (StateLogger, optional) -- The state logger. Defaults to None.
- Returns:
The default conditional numerical solver.
- Return type:
- static fixed_step_size(
- stepper_type: ostk.mathematics.solver.NumericalSolver.StepperType,
- time_step: ostk.core.type.Real,
Return a Numerical Solver using a fixed stepper.
- Returns:
The numerical solver.
- Return type:
- get_absolute_tolerance( ) ostk.core.type.Real¶
Get the absolute tolerance of the solver.
- Returns:
The absolute tolerance value.
- Return type:
Example
>>> solver = NumericalSolver.default() >>> abs_tol = solver.get_absolute_tolerance()
- get_log_type( ) ostk::mathematics::solver::NumericalSolver::LogType¶
Get the log type of the solver.
- Returns:
The log type.
- Return type:
Example
>>> solver = NumericalSolver.default() >>> log_type = solver.get_log_type()
- get_observed_state_vectors( ) list[tuple[numpy.ndarray[numpy.float64[m, 1]], float]]¶
Get the observed state vectors from the last integration.
- Returns:
List of observed state vectors during integration.
- Return type:
Example
>>> solver = NumericalSolver.default() >>> # After performing integration... >>> states = solver.get_observed_state_vectors()
- get_observed_states( ) list[ostk.astrodynamics.trajectory.State]¶
Get the observed states.
- get_relative_tolerance( ) ostk.core.type.Real¶
Get the relative tolerance of the solver.
- Returns:
The relative tolerance value.
- Return type:
Example
>>> solver = NumericalSolver.default() >>> rel_tol = solver.get_relative_tolerance()
- get_root_solver( ) ostk.astrodynamics.RootSolver¶
Get the root solver.
- Returns:
The root solver.
- Return type:
- get_stepper_type( ) ostk::mathematics::solver::NumericalSolver::StepperType¶
Get the stepper type of the solver.
- Returns:
The stepper type.
- Return type:
Example
>>> solver = NumericalSolver.default() >>> stepper_type = solver.get_stepper_type()
- get_time_step( ) ostk.core.type.Real¶
Get the time step of the solver.
- Returns:
The time step value.
- Return type:
Example
>>> solver = NumericalSolver.default() >>> time_step = solver.get_time_step()
- integrate_duration(*args, **kwargs)¶
Overloaded function.
integrate_duration(self: ostk.mathematics.solver.NumericalSolver, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: ostk.core.type.Real, arg2: object) -> tuple[numpy.ndarray[numpy.float64[m, 1]], float]
Integrate a system of differential equations for a specified duration.
- Args:
state_vector (StateVector): Initial state vector. duration_in_seconds (float): Integration duration in seconds. system_of_equations (callable): Function defining the system of ODEs.
Signature: f(x, dxdt, t) -> StateVector
- Returns:
StateVector: Final state vector after integration.
- Example:
>>> def equations(x, dxdt, t): ... dxdt[0] = x[1] # dx/dt = v ... dxdt[1] = -x[0] # dv/dt = -x (harmonic oscillator) ... return dxdt >>> solver = NumericalSolver.default() >>> initial_state = [1.0, 0.0] # x=1, v=0 >>> final_state = solver.integrate_duration(initial_state, 1.0, equations)
integrate_duration(self: ostk.mathematics.solver.NumericalSolver, arg0: numpy.ndarray[numpy.float64[m, 1]], arg1: list[ostk.core.type.Real], arg2: object) -> list[tuple[numpy.ndarray[numpy.float64[m, 1]], float]]
Integrate a system of differential equations at multiple duration points.
- Args:
state_vector (StateVector): Initial state vector. duration_array (list): Array of duration values in seconds. system_of_equations (callable): Function defining the system of ODEs.
Signature: f(x, dxdt, t) -> StateVector
- Returns:
list: State vectors at each duration point.
- Example:
>>> def equations(x, dxdt, t): ... dxdt[0] = x[1] # dx/dt = v ... dxdt[1] = -x[0] # dv/dt = -x (harmonic oscillator) ... return dxdt >>> solver = NumericalSolver.default() >>> initial_state = [1.0, 0.0] >>> durations = [0.5, 1.0, 1.5] >>> states = solver.integrate_duration(initial_state, durations, equations)
- integrate_time(*args, **kwargs)¶
Overloaded function.
integrate_time(self: ostk.astrodynamics.trajectory.state.NumericalSolver, state: ostk.astrodynamics.trajectory.State, instant: ostk.physics.time.Instant, system_of_equations: object) -> ostk.astrodynamics.trajectory.State
Integrate the trajectory to a given instant.
- Args:
state (State): The initial state of the trajectory. instant (Instant): The instant to integrate to. system_of_equations (callable): The system of equations.
- Returns:
State: The state at the requested time.
integrate_time(self: ostk.astrodynamics.trajectory.state.NumericalSolver, state: ostk.astrodynamics.trajectory.State, instants: list[ostk.physics.time.Instant], system_of_equations: object) -> list[ostk.astrodynamics.trajectory.State]
Integrate the trajectory to a set of instants.
- Args:
state (State): The initial state of the trajectory. instants (list[Instant]): The instants to integrate to. system_of_equations (callable): The system of equations.
- Returns:
list[State]: The states at the requested times.
integrate_time(self: ostk.astrodynamics.trajectory.state.NumericalSolver, state: ostk.astrodynamics.trajectory.State, instant: ostk.physics.time.Instant, system_of_equations: object, event_condition: ostk::astrodynamics::EventCondition) -> ostk.astrodynamics.trajectory.state.NumericalSolver.ConditionSolution
Integrate the trajectory to a given instant, with an event condition.
- Args:
state (State): The initial state of the trajectory. instant (Instant): The instant to integrate to. system_of_equations (callable): The system of equations. event_condition (EventCondition): The event condition.
- Returns:
ConditionSolution: The solution to the event condition.
- is_defined( ) bool¶
Check if the numerical solver is defined.
- Returns:
True if the numerical solver is defined, False otherwise.
- Return type:
- static string_from_log_type(
- log_type: ostk::mathematics::solver::NumericalSolver::LogType,
Get string representation of a log type.
- Parameters:
log_type (NumericalSolver.LogType) -- The log type.
- Returns:
String representation of the log type.
- Return type:
Example
>>> NumericalSolver.string_from_log_type(NumericalSolver.LogType.NoLog)
- static string_from_stepper_type(
- stepper_type: ostk::mathematics::solver::NumericalSolver::StepperType,
Get string representation of a stepper type.
- Parameters:
stepper_type (NumericalSolver.StepperType) -- The stepper type.
- Returns:
String representation of the stepper type.
- Return type:
Example
>>> NumericalSolver.string_from_stepper_type(NumericalSolver.StepperType.RungeKutta4)
- static undefined() ostk.astrodynamics.trajectory.state.NumericalSolver¶
Return an undefined numerical solver.
- Returns:
The undefined numerical solver.
- Return type: