mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
The Kepler Problem

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). More...
 
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. More...
 
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. More...
 
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. More...
 

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 50 of file kepler.hpp.

Referenced by mx::astro::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 89 of file kepler.hpp.

Referenced by mx::astro::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 161 of file kepler.hpp.

References mx::astro::hyperbolic_kepler(), and mx::astro::solve_kepler_danby().

Referenced by mx::astro::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 119 of file kepler.hpp.

References mx::astro::kepler_danby_1(), and mx::math::func::sign().

Referenced by mx::astro::solve_kepler().