Skip to content

Documentation / @interstellar-tools/equations / stumpffS

Function: stumpffS() ​

ts
function stumpffS(z: number): number;

Defined in: helpers/stumpff.ts:104

Compute the Stumpff function S(z), used by the universal-variable formulation of the two-body problem.

S(z)={z−sin⁡zz3z>0sinh⁡−z−−z−z3z<016z=0=∑k=0∞(−z)k(2k+3)!

Where z=αχ2 is the universal anomaly squared, scaled by α=1/a: positive on an ellipse, zero on a parabola and negative on a hyperbola.

Notes

  • Near z=0 (for |z|<0.1) the series is used, since z−sin⁡z loses digits to cancellation there.
  • S decreases as z grows, and stays positive.

Parameters ​

ParameterTypeDescription
znumberThe argument z (finite, dimensionless).

Returns ​

number

S(z).

Throws ​

If z is not a finite number.

Example ​

ts
stumpffS(0); // 1/6
stumpffS(Math.PI ** 2); // 1 / π² ≈ 0.1013

See ​