Documentation / @interstellar-tools/equations / accelerationOn1By2
Function: accelerationOn1By2()
ts
function accelerationOn1By2(
m2: number,
r1: Vector3DTupleType,
r2: Vector3DTupleType,
G?: number
): Vector3DTupleType;Defined in: gravity/acceleration-on1-by2.ts:69
Gravitational acceleration of body 1 due to body 2 (vector, m/s²).
Definitions
Acceleration field
Units
- Inputs: masses in kg, positions in m, (
) in m³·kg⁻¹·s⁻². - Output: acceleration in m/s².
INFO
- Implemented via
gravitationalForce(1, m2, r1, r2, G), so the returned vector equals the force on a 1 kg test mass (i.e., the acceleration). - Direction points from body 1 toward body 2: ($ \hat{\mathbf r} $).
Invariants (within FP tolerance)
||a|| = G*m2/r²a = ||a|| * r̂
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
m2 | number | undefined | Mass of body 2 (kg). |
r1 | Vector3DTupleType | undefined | Position of body 1 [x, y, z] in meters. |
r2 | Vector3DTupleType | undefined | Position of body 2 [x, y, z] in meters. |
G? | number | G_SI | Gravitational constant. |
Returns
Acceleration of body 1 due to body 2 (m/s²).
Examples
ts
// Acceleration of a satellite due to Earth at ~7000 km from Earth's center
const mSat = 500; // kg (any value; a is independent of mSat)
const mEarth = 5.972e24; // kg
const rSat: [number, number, number] = [7.0e6, 0, 0]; // m
const rEarth: [number, number, number] = [0, 0, 0];
const a = accelerationOn1By2(mSat, mEarth, rSat, rEarth);
// ≈ [-8.14, 0, 0] m/s² (toward Earth)ts
// Derive force from acceleration (F = m1 * a)
const m1 = 1200; // kg spacecraft
const a = accelerationOn1By2(m1, mEarth, rSat, rEarth);
const F: [number, number, number] = [a[0] * m1, a[1] * m1, a[2] * m1]; // newtonsSee
https://en.wikipedia.org/wiki/Newton's_law_of_universal_gravitation