Skip to content

Documentation / @interstellar-tools/equations / visVivaSpeed

Function: visVivaSpeed() ​

ts
function visVivaSpeed(r: number, a: number, mu: number): number;

Defined in: orbits/vis-viva-speed.ts:60

Vis-viva (orbital speed) - compute speed magnitude (v) from (r), (a), and (μ).

Definition

v=μ(2r−1a)
  • (r): current distance from the focus (m)
  • (a): semi-major axis (m). Elliptic (a>0), parabolic (a→∞), hyperbolic (a<0)
  • (μ): gravitational parameter (m³/s²)

Units

  • Inputs: (r) in m, (a) in m, (μ) in m³/s².
  • Output: (v) in m/s.

TIP

  • For circular orbits ((a=r)): (v=μ/r).
  • For parabolic trajectories, pass a = Infinity (so (1/a=0)): (v=2μ/r).
In practiceDeparting for Mars

32.73 km/s

Speed at the start of a Hohmann transfer to Mars

Earth moves around the Sun at 29.78 km/s, so a spacecraft leaving on the transfer orbit needs 2.95 km/s on top of Earth's own speed.

ts
const au = 1.495978707e11; // m
const muSun = 1.32712440018e20; // m³/s²
const a = ((1 + 1.524) / 2) * au; // transfer orbit

visVivaSpeed(au, a, muSun); // ≈ 32 731 m/s

Parameters ​

ParameterTypeDescription
rnumberRadius (r) (m), distance to the attracting body.
anumberSemi-major axis (a) (m). Use Infinity for parabolic, negative for hyperbolic.
munumberGravitational parameter (μ) (m³/s²).

Returns ​

number

Speed magnitude (v) (m/s).

Throws ​

Error If inputs are non-finite / out of domain, or the radicand becomes negative.

Example ​

ts
// LEO (~400 km): a ≈ r for near-circular
const muEarth = 3.986004418e14; // m³/s²
const r = 6378e3 + 400e3; // m
const a = r; // circular
const v = visVivaSpeed(r, a, muEarth); // ≈ 7670 m/s