Fundamental astrodynamics algorithms