Documentation / @interstellar-tools/equations / trueToMeanAnomaly
Function: trueToMeanAnomaly()
function trueToMeanAnomaly(V: Radians, e: number): Radians;Defined in: anomalies/true-to-mean-anomaly.ts:77
Converts true anomaly (
Mathematical Explanation:
In orbital mechanics, the true anomaly (
Step 1: Convert True Anomaly (
This transformation ensures that atan2(y, x) instead of atan(x) to avoid ambiguity in angle computation.
Step 2: Convert Eccentric Anomaly (
Kepler’s equation states:
Since anomalies are periodic over one full orbit (wrapAngle(M) to ensure that the computed mean anomaly remains within this range.
Why Use wrapAngle?
- Ensures that the mean anomaly is always wrapped within
. - Corrects floating-point precision issues that may cause values slightly greater than
. - Prevents negative anomalies by shifting them into the valid range.
Parameters
| Parameter | Type | Description |
|---|---|---|
V | Radians | True anomaly ( |
e | number | Eccentricity of the orbit ( |
Returns
The mean anomaly (
Throws
RangeError If the eccentricity (
Examples
import { trueToMeanAnomaly } from '@interstellar-tools/equations';
// Example 1: Standard elliptical orbit
const V = Math.PI / 3; // 60 degrees in radians
const e = 0.1; // Eccentricity
console.log(trueToMeanAnomaly(V, e)); // Output: Mean anomaly in radians// Example 2: Retrograde motion handling
const V_retrograde = -Math.PI / 2; // -90 degrees
const e_retrograde = 0.2;
console.log(trueToMeanAnomaly(V_retrograde, e_retrograde));