Skip to content

Documentation / @interstellar-tools/equations / advanceMeanAnomaly

Function: advanceMeanAnomaly() ​

ts
function advanceMeanAnomaly(
  orbit: Pick<OrbitInterface, 'e' | 'angle' | 'period'>,
  timeStep: TemporalInterface
): Radians;

Defined in: anomalies/advance-mean-anomaly.ts:66

Advances an orbit by a time step and returns its new mean anomaly (M).

The orbit's angle (true anomaly) is the starting point. To get the eccentric anomaly from the result, pass it to solveKepler. To find a body at a given date, use meanAnomalyAt or trueAnomalyAt.

Mathematical Explanation:

The mean anomaly is a measure of the position of an orbiting body as if it moved with uniform angular motion along a circular orbit with the same period as the actual elliptical orbit. It grows linearly with time:

M=M0+n⋅ΔT,n=2π|P|

where:

  • M0 is the initial mean anomaly, converted from the true anomaly angle.
  • n is the mean motion, from the period P in days. P is a positive duration; a negative one, from data in the old 0.x convention, is read as its absolute value. A positive step always moves the body forward.
  • ΔT is the time step, converted to days from its unit.

The step can be any length, from a fraction of a second to many orbits, and negative to go back in time. The result is wrapped to [0,2π).

Parameters ​

ParameterTypeDescription
orbitPick<OrbitInterface, "e""angle"
timeStepTemporalInterfaceHow far to advance, in any temporal unit; negative goes back in time.

Returns ​

Radians

The mean anomaly after the time step, in [0,2π).

Throws ​

RangeError If the orbit's eccentricity is outside the range 0≤e<1.

Example ​

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

const marsOrbit = {
  e: 0.0934, // Eccentricity of Mars' orbit
  angle: 1.047 as Radians, // Initial true anomaly (in radians)
  period: { value: 687, unit: 'd' } // Orbital period in days
};

advanceMeanAnomaly(marsOrbit, { value: 1, unit: 'd' }); // one day on
advanceMeanAnomaly(marsOrbit, { value: 10, unit: 'yr' }); // ten years on
advanceMeanAnomaly(marsOrbit, { value: -1, unit: 'd' }); // one day back

See ​