orbix.kepler.shortcuts.fixed_e

orbix.kepler.shortcuts.fixed_e#

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#

E_lookup(e[, n])

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

E_linear_interp(e[, n])

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

E_hermite_interp(e[, n])

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

Module Contents#

orbix.kepler.shortcuts.fixed_e.E_lookup(e, n=2048)[source]#

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

Parameters:
  • e – The eccentricity of the orbit.

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

orbix.kepler.shortcuts.fixed_e.E_linear_interp(e, n=2048)[source]#

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.

Parameters:
  • e – The eccentricity of the orbit.

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

orbix.kepler.shortcuts.fixed_e.E_hermite_interp(e, n=2048)[source]#

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.

Parameters:
  • e – The eccentricity of the orbit.

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