Class KeplerSolver

java.lang.Object
gaiasky.util.elements.KeplerSolver

public class KeplerSolver extends Object
Solve the elliptical Kepler Equation by bisections and Newton method with Taylor-expanded trigonometric functions.

This class is immutable.

The algorithm is taken from
T. Fukushima, 1996, Astron. J, 112, 2858.

It is designed for a general equation of the form
  
   D - eX sin D + eY cos D = L,
  
  with
  
   eX2 + eY2 ≤ 1
  
 

But this implementation deals only with the case
  
   eY = 0
  
 
and is optimized for that case.
The method to solve the Kepler equation is given in two versions: The second version is faster, but it is assumed that the mean anomaly is between 0 and 2π.
Methods to compute the true anomaly from the eccentric anomaly and the eccentricity are also available in two versions.

Re-coded from Fortran and C.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor with default values for tolerance (1e-16) and maximum number of iterations (50).
    KeplerSolver(double errMax, int iterMax)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final double
    eccAnom(double mA, double ecc)
    Solve Kepler Equation (see reference above).
    final double
    eccAnomConstrained(double mA, double ecc)
    Solve Kepler Equation by bisections and Newton method with Taylor expanded trigonometric functions.
    static double
    error(double eA, double mA, double ecc)
    Compute the absolute error of Kepler equation given the mean and eccentric anomalies and the eccentricity.
    static double
    meanAnom(double eA, double ecc)
    Compute mean anomaly (applying Kepler Equation).
    static double
    meanAnomConstrained(double eA, double ecc)
    Compute mean anomaly (applying Kepler Equation).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeplerSolver

      public KeplerSolver(double errMax, int iterMax)
      Parameters:
      errMax - Error tolerance.
      iterMax - Maximum number of iterations.
    • KeplerSolver

      public KeplerSolver()
      Constructor with default values for tolerance (1e-16) and maximum number of iterations (50).
  • Method Details

    • eccAnom

      public final double eccAnom(double mA, double ecc)
      Solve Kepler Equation (see reference above). This method calls eccAnomConstrained to perform the actual resolution.
      Parameters:
      mA - Mean anomaly.
      ecc - Eccentricity.
      Returns:
      the eccentric anomaly.
      Throws:
      IllegalArgumentException - if ecc is not in the interval [0, 1).
    • eccAnomConstrained

      public final double eccAnomConstrained(double mA, double ecc)
      Solve Kepler Equation by bisections and Newton method with Taylor expanded trigonometric functions. Note that, for performance, no consistency checks are performed on the input.
      Parameters:
      mA - Mean anomaly, assumed to be between 0 and 2pi.
      ecc - Eccentricity, assumed to be between 0 and 1.
      Returns:
      the eccentric anomaly in the range of 0 through 2pi.
      Throws:
      IllegalStateException - if the root could not be found within the specified accuracy in less than the number of iterations.
    • error

      public static double error(double eA, double mA, double ecc)
      Compute the absolute error of Kepler equation given the mean and eccentric anomalies and the eccentricity.
      Parameters:
      eA - eccentric anomaly.
      mA - mean anomaly.
      ecc - eccentricity.
      Returns:
      the error.
    • meanAnomConstrained

      public static double meanAnomConstrained(double eA, double ecc)
      Compute mean anomaly (applying Kepler Equation). Note that, in this version, no consistency checks are performed on the input.
      Parameters:
      eA - Eccentric anomaly.
      ecc - Eccentricity.
      Returns:
      the mean anomaly.
    • meanAnom

      public static double meanAnom(double eA, double ecc)
      Compute mean anomaly (applying Kepler Equation).
      Parameters:
      eA - Eccentric anomaly.
      ecc - Eccentricity.
      Returns:
      the mean anomaly.
      Throws:
      IllegalArgumentException - if ecc is not in the interval [0, 1).