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
Common approximation, when (
Units
- Inputs: masses in kg, (
) 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
Mandm.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
M | number | undefined | Mass of the primary body (kg). |
m | number | 0 | Mass of the secondary body (kg). Defaults to 0. |
G? | number | G_SI | Gravitational constant. Defaults to G_SI. |
Returns
number
Gravitational parameter (
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);