Skip to content

Documentation / @interstellar-tools/equations / gravitationalParameter

Function: gravitationalParameter() ​

ts
function gravitationalParameter(M: number, m?: number, G?: number): number;

Defined in: gravity/gravitational-parameter.ts:50

Two-body gravitational parameter (μ).

Definition

μ=G(M+m)

Common approximation, when (M≫m)

μ≈GM

Units

  • Inputs: masses in kg, ( G ) in m³·kg⁻¹·s⁻² (defaults to G_SI).
  • Output: (μ) in m³/s².

TIP

  • Use m = 0 (default) for the standard published (μ) of a central body.
  • When modelling a binary with comparable masses, pass both M and m.

Parameters ​

ParameterTypeDefault valueDescription
MnumberundefinedMass of the primary body (kg).
mnumber0Mass of the secondary body (kg). Defaults to 0.
G?numberG_SIGravitational constant. Defaults to G_SI.

Returns ​

number

Gravitational parameter (μ) in m³/s².

Throws ​

Error If M is non-finite or negative.

Throws ​

Error If m is non-finite or negative.

Throws ​

Error If G is non-finite or negative.

Example ​

ts
// Standard gravitational parameter for Earth (approximate: m ~ 0)
const muEarth = gravitationalParameter(5.97219e24); // ≈ 3.986004e14 m³/s²

// Earth + 1000 kg satellite: practically identical to GM
const muExact = gravitationalParameter(5.97219e24, 1000);

// Earth–Moon system (two-body μ)
const muEarthMoon = gravitationalParameter(5.97219e24, 7.342e22);