ostk.astrodynamics.RootSolver

class RootSolver(
self: ostk.astrodynamics.RootSolver,
maximum_iteration_count: int,
tolerance: ostk.core.type.Real,
)

Bases: pybind11_object

A root solver is an algorithm for finding a zero-crossing of a function.

Constructor.

Parameters:
  • int -- The maximum number of iterations allowed.

  • float -- The tolerance of the root solver.

Methods

bisection

Solve the root of a function using the bisection method.

bracket_and_solve

Bracket and solve the root of a function.

default

Return the default root solver.

get_maximum_iteration_count

Get the maximum number of iterations allowed.

get_tolerance

Get the tolerance of the root solver.

solve

Solve the root of a function.

class Solution

Bases: pybind11_object

A root solver solution.

property has_converged

Whether the root solver has converged.

Type:

bool

property iteration_count

The number of iterations required to find the root.

Type:

int

property root

The root of the function.

Type:

float

bisection(
self: ostk.astrodynamics.RootSolver,
function: Callable[[float], float],
lower_bound: ostk.core.type.Real,
upper_bound: ostk.core.type.Real,
) ostk.astrodynamics.RootSolver.Solution

Solve the root of a function using the bisection method.

Parameters:
  • function (callable) -- The function to solve.

  • lower_bound (float) -- The lower bound of the root.

  • upper_bound (float) -- The upper bound of the root.

Returns:

The solution to the root.

Return type:

RootSolverSolution

bracket_and_solve(
self: ostk.astrodynamics.RootSolver,
function: Callable[[float], float],
initial_guess: ostk.core.type.Real,
is_rising: bool,
) ostk.astrodynamics.RootSolver.Solution

Bracket and solve the root of a function.

Parameters:
  • function (callable) -- The function to solve.

  • initial_guess (float) -- The initial guess for the root.

  • is_rising (bool) -- Whether the function is rising.

Returns:

The solution to the root.

Return type:

RootSolverSolution

static default() ostk.astrodynamics.RootSolver

Return the default root solver.

Returns:

The default root solver.

Return type:

RootSolver

get_maximum_iteration_count(self: ostk.astrodynamics.RootSolver) int

Get the maximum number of iterations allowed.

Returns:

The maximum number of iterations allowed.

Return type:

int

get_tolerance(self: ostk.astrodynamics.RootSolver) ostk.core.type.Real

Get the tolerance of the root solver.

Returns:

The tolerance of the root solver.

Return type:

float

solve(
self: ostk.astrodynamics.RootSolver,
function: Callable[[float], float],
lower_bound: ostk.core.type.Real,
upper_bound: ostk.core.type.Real,
) ostk.astrodynamics.RootSolver.Solution

Solve the root of a function.

Parameters:
  • function (callable) -- The function to solve.

  • lower_bound (float) -- The lower bound of the root.

  • upper_bound (float) -- The upper bound of the root.

Returns:

The solution to the root.

Return type:

RootSolverSolution