orbix.kepler.shortcuts.fixed_e
==============================

.. py:module:: orbix.kepler.shortcuts.fixed_e

.. autoapi-nested-parse::

   Fixed eccentricity shortcuts for Kepler's equation.

   These are useful if you are solving Kepler's equation many times with the same
   eccentricity, since they pre-compute the eccentric anomaly for all mean
   anomalies and create fast, JIT-compiled functions that either return the
   nearest value (`E_lookup`) or interpolate between them (`E_linear_interp` and
   `E_hermite_interp`).

   The functions return a JIT-compiled function that takes a mean anomaly
   and returns the eccentric anomaly. The eccentric anomaly is computed using
   the `E_solve` function from the `kepler.core` module. Each method is optimized
   to do as few operations as possible and pre-calculate any constants that are
   not dependent on the mean anomaly. Those constants are included in the returned
   function by closure.



Functions
---------

.. autoapisummary::

   orbix.kepler.shortcuts.fixed_e.E_lookup
   orbix.kepler.shortcuts.fixed_e.E_linear_interp
   orbix.kepler.shortcuts.fixed_e.E_hermite_interp


Module Contents
---------------

.. py:function:: E_lookup(e, n=2048)

   Create a JIT'd function to lookup E for a fixed eccentricity.

   :param e: The eccentricity of the orbit.
   :param n: The number of mean anomaly values to use in the lookup table.

   :returns: A JIT-compiled function that takes M (as either a scalar or an array) and
             returns E (as a scalar or an array).


.. py:function:: E_linear_interp(e, n=2048)

   Create a JIT'd function to interpolate E for a fixed eccentricity.

   This method uses linear interpolation to find the eccentric anomaly. The
   basic idea is to turn most operations into integer operations by scaling
   the mean anomaly into the same index space as the lookup table, then using
   the integer part of the index to index into the table and the fractional
   part to linearly interpolate.

   :param e: The eccentricity of the orbit.
   :param n: The number of mean anomaly values to use in the lookup table.

   :returns: A JIT-compiled function that takes M (as either a scalar or an array) and
             returns E (as a scalar or an array).


.. py:function:: E_hermite_interp(e, n=2048)

   Create a JIT'd function to interpolate E for a fixed eccentricity.

   This method uses Hermite interpolation to find the eccentric anomaly. Like
   in the linear interpolation method, we turn most operations into integer
   operations by scaling the mean anomaly into the same index space as the
   lookup table, then using the integer part of the index to index into the
   table and the fractional part to do Hermite interpolation.

   :param e: The eccentricity of the orbit.
   :param n: The number of mean anomaly values to use in the lookup table.

   :returns: A JIT-compiled function that takes M (as either a scalar or an array) and
             returns E (as a scalar or an array).


