mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches

Utilities for solving the Kepler problem.

Functions

template<typename realT>
long mx::astro::hyperbolic_kepler (realT &E, realT &err, realT e, realT M, realT tol, long itmax)
 Solve the hyperbolic kepler equation (for e> 1).
template<typename realT>
realT mx::astro::kepler_danby_1 (realT e, realT M, realT Ei)
 Calculate the next iteration of Danby's quartic Newton-Raphson method.
template<typename realT>
long mx::astro::solve_kepler_danby (realT &E, realT &D, realT e, realT M, realT tol, long itmax)
 Solve Kepler's equation using Danby's quartic Newton-Raphson method.
template<typename realT>
long mx::astro::solve_kepler (realT &E, realT &D, realT e, realT M, realT tol=KEPLER_TOL, long itmax=KEPLER_ITMAX)
 Solve Kepler's equation for any e. Uses solve_kepler_danby if e < 1.0, hyperbolic_kepler otherwise.

Function Documentation

◆ hyperbolic_kepler()

template<typename realT>
long mx::astro::hyperbolic_kepler ( realT & E,
realT & err,
realT e,
realT M,
realT tol,
long itmax )

Solve the hyperbolic kepler equation (for e> 1).

Note
this is not tested very well (as of 2014.08.09)
Returns
-1 on exceeding itmax, otherwise reurns the number of iterations.
Template Parameters
realTis the type used for arithmetic
Parameters
[out]Eis the eccentric anomaly
[out]erris the error after the last iteration
[in]eis the eccentricity
[in]Mis the mean anomaly
[in]tolis the desired tolerance
[in]itmaxis the maximum number of iterations

Definition at line 44 of file kepler.hpp.

Referenced by solve_kepler().

◆ kepler_danby_1()

template<typename realT>
realT mx::astro::kepler_danby_1 ( realT e,
realT M,
realT Ei )

Calculate the next iteration of Danby's quartic Newton-Raphson method.

Definition at line 85 of file kepler.hpp.

Referenced by solve_kepler_danby().

◆ solve_kepler()

template<typename realT>
long mx::astro::solve_kepler ( realT & E,
realT & D,
realT e,
realT M,
realT tol = KEPLER_TOL,
long itmax = KEPLER_ITMAX )

Solve Kepler's equation for any e. Uses solve_kepler_danby if e < 1.0, hyperbolic_kepler otherwise.

Returns
the number of iterations on success.
-1 if itmax is exceeded.
Parameters
[out]Eis the eccentric anomaly
[out]Dis the error after the last iteration
[in]eis the eccentricity
[in]Mis the mean anomaly
[in]tolis the desired tolerance
[in]itmaxis the maximum number of iterations

Definition at line 156 of file kepler.hpp.

References hyperbolic_kepler(), KEPLER_ITMAX, KEPLER_TOL, and solve_kepler_danby().

Referenced by orbitElements().

◆ solve_kepler_danby()

template<typename realT>
long mx::astro::solve_kepler_danby ( realT & E,
realT & D,
realT e,
realT M,
realT tol,
long itmax )

Solve Kepler's equation using Danby's quartic Newton-Raphson method.

Returns
-1 on exceeding itmax.
the number of iterations on success.
Parameters
[out]Eis the eccentric anomaly
[out]Dis the error after the last iteration
[in]eis the eccentricity
[in]Mis the mean anomaly
[in]tolis the desired tolerance
[in]itmaxis the maximum number of iterations

Definition at line 113 of file kepler.hpp.

References kepler_danby_1().

Referenced by solve_kepler().