Skip to content

Documentation / @interstellar-tools/equations / solveKeplerHighEccentricity

Function: solveKeplerHighEccentricity() ​

ts
function solveKeplerHighEccentricity(
  M: Radians,
  e: number,
  maxIter?: number,
  tolerance?: number
): Radians;

Defined in: kepler/solve-kepler-high-eccentricity.ts:104

Solves Kepler's Equation for the Eccentric Anomaly (E) in highly eccentric orbits (e>0.9) using an iterative numerical approach.

Mathematical Explanation:

Kepler's equation for eccentric anomaly (E) is:

solve-kelper-high-eccentricity-elliptical-orbit

M=E−esin⁡(E)(for elliptical orbits, 0<e<1)

solve-kepler-high-eccentricity-hyperbolic-orbit

M=esinh⁡(E)−E(for hyperbolic orbits, e>1)

For orbits with high eccentricity (e≈1), standard Newton-Raphson solvers struggle due to extreme changes in orbital velocity near perihelion. Instead, we apply a fixed-point iteration method that is more stable for these cases.


Solving Strategy:

  1. Initial Guess:
    • Elliptical (e<1): the equation is 2π-periodic, so M is first reduced to one turn with its sign kept (Mmod2π), then Danby's starting value is used:
E0=M+0.85esign(sin⁡M)
  • Hyperbolic (e>1):
E0=M±esin⁡(M)1−ecos⁡(M)
  1. Iterative Refinement:
    • The method updates E using:
ΔE=E−esin⁡(E)−M1−ecos⁡(E)

for elliptical orbits.

ΔE=esinh⁡(E)−E−Mecosh⁡(E)−1

for hyperbolic orbits.

  • Iteration stops when:
|En+1−En|<tolerance

(default tolerance is 1e-9).

  1. Angle Wrapping (Elliptical Only):
    • The result is wrapped using wrapAngle(), which keeps the sign: E∈(−2π,2π) with the sign of M. Use solveKepler() for a result normalized to [0,2π).

Performance Considerations:

  • Typically converges in fewer than 10 iterations for e>0.9.
  • Time complexity: O(1) for standard convergence.

Parameters ​

ParameterTypeDefault valueDescription
MRadiansundefinedMean anomaly (M) in radians.
enumberundefinedOrbital eccentricity (e>0.9 for high-eccentricity orbits).
maxIter?number...Maximum number of iterations before failure.
tolerance?number1e-9Convergence criterion for stopping the iteration.

Returns ​

Radians

The eccentric anomaly (E) in radians (for elliptical orbits in (−2π,2π), with the sign of M).

Examples ​

ts
import { solveKeplerHighEccentricity } from '@interstellar-tools/equations';

const M = Math.PI / 4; // 45 degrees in radians
const e = 0.95; // High orbital eccentricity
const result = solveKeplerHighEccentricity(M, e);
console.log(result); // Output: Eccentric anomaly in radians
ts
// Hyperbolic orbit example (e > 1)
const M_hyperbolic = 2.0; // Mean anomaly for hyperbolic orbit
const e_hyperbolic = 1.2; // Hyperbolic eccentricity
console.log(solveKeplerHighEccentricity(M_hyperbolic, e_hyperbolic));

See ​