ostk.astrodynamics.solver.FiniteDifferenceSolver

class FiniteDifferenceSolver(
self: ostk.astrodynamics.solver.FiniteDifferenceSolver,
type: ostk.astrodynamics.solver.FiniteDifferenceSolver.Type,
step_percentage: ostk.core.type.Real,
step_duration: ostk.physics.time.Duration,
)

Bases: pybind11_object

A Finite Difference Solver to compute the gradient, state transition matrix, and jacobian of a function.

Construct a FiniteDifferenceSolver.

Parameters:
  • type (FiniteDifferenceSolver.Type) -- Type of finite difference scheme.

  • step_percentage (float) -- The step percentage to use for computing the STM/Jacobian.

  • step_duration (Duration) -- The step duration to use for computing the gradient.

Returns:

The FiniteDifferenceSolver.

Return type:

FiniteDifferenceSolver

Methods

compute_gradient

Compute the gradient.

compute_jacobian

Compute the jacobian.

compute_state_transition_matrix

Overloaded function.

default

Get the default Finite Difference Solver.

get_step_duration

Get the step duration used for computing the gradient.

get_step_percentage

Get the step percentage used for computing the STM.

get_type

Get the type.

string_from_type

Convert a type to string.

class Type(
self: ostk.astrodynamics.solver.FiniteDifferenceSolver.Type,
value: int,
)

Bases: pybind11_object

Type of finite difference scheme.

Members:

Forward : Forward difference scheme.

Backward : Backward difference scheme.

Central : Central difference scheme.

property name
compute_gradient(self: ostk.astrodynamics.solver.FiniteDifferenceSolver, state: ostk::astrodynamics::trajectory::State, generate_state_coordinates: Callable[[ostk::astrodynamics::trajectory::State, ostk.physics.time.Instant], numpy.ndarray[numpy.float64[m, 1]]]) numpy.ndarray[numpy.float64[m, 1]]

Compute the gradient.

Parameters:
  • state (State) -- The state.

  • generate_state_coordinates (function) -- The function to generate the state coordinates.

Returns:

The gradient.

Return type:

np.array

compute_jacobian(self: ostk.astrodynamics.solver.FiniteDifferenceSolver, state: ostk::astrodynamics::trajectory::State, generate_state_coordinates: Callable[[ostk::astrodynamics::trajectory::State, ostk.physics.time.Instant], numpy.ndarray[numpy.float64[m, 1]]]) numpy.ndarray[numpy.float64[m, n]]

Compute the jacobian.

Parameters:
  • state (State) -- The state.

  • generate_state_coordinates (function) -- The function to generate the state coordinates.

Returns:

The jacobian.

Return type:

np.array

compute_state_transition_matrix(*args, **kwargs)

Overloaded function.

  1. compute_state_transition_matrix(self: ostk.astrodynamics.solver.FiniteDifferenceSolver, state: ostk::astrodynamics::trajectory::State, instants: list[ostk.physics.time.Instant], generate_states_coordinates: Callable[[ostk::astrodynamics::trajectory::State, list[ostk.physics.time.Instant]], numpy.ndarray[numpy.float64[m, n]]]) -> list[numpy.ndarray[numpy.float64[m, n]]]

    Compute a list of state transition matrix (STM) at the provided instants.

    Args:

    state (State): The state. instants (Array(Instant)): The instants at which to calculate the STM. generate_states_coordinates (callable): The function to get the states coordinates as a matrix. Each column is a set of state coordinates.

    Returns:

    np.array: The list of state transition matrices.

  2. compute_state_transition_matrix(self: ostk.astrodynamics.solver.FiniteDifferenceSolver, state: ostk::astrodynamics::trajectory::State, instant: ostk.physics.time.Instant, generate_state_coordinates: Callable[[ostk::astrodynamics::trajectory::State, ostk.physics.time.Instant], numpy.ndarray[numpy.float64[m, 1]]]) -> numpy.ndarray[numpy.float64[m, n]]

    Compute the state transition matrix (STM).

    Args:

    state (State): The state. instant (Instant): The instant at which to calculate the STM. generate_state_coordinates (callable): The function to get the state coordinates. Must be a column vector.

    Returns:

    np.array: The state transition matrix.

static default() ostk.astrodynamics.solver.FiniteDifferenceSolver

Get the default Finite Difference Solver.

Returns:

The default Finite Difference Solver.

Return type:

FiniteDifferenceSolver

get_step_duration(
self: ostk.astrodynamics.solver.FiniteDifferenceSolver,
) ostk.physics.time.Duration

Get the step duration used for computing the gradient.

Returns:

The step duration.

Return type:

Duration

get_step_percentage(
self: ostk.astrodynamics.solver.FiniteDifferenceSolver,
) ostk.core.type.Real

Get the step percentage used for computing the STM.

Returns:

The step percentage.

Return type:

float

get_type(
self: ostk.astrodynamics.solver.FiniteDifferenceSolver,
) ostk.astrodynamics.solver.FiniteDifferenceSolver.Type

Get the type.

Returns:

The type.

Return type:

FiniteDifferenceSolver.Type

static string_from_type(
type: ostk.astrodynamics.solver.FiniteDifferenceSolver.Type,
) ostk.core.type.String

Convert a type to string.

Parameters:

type (FiniteDifferenceSolver.Type) -- The type.

Returns:

The string name of the type.

Return type:

str