At the heart of all guidance and navigation computations by the Apollo
Guidance Computers (AGC) onboard the CSM and LM was the State Vector
(SV): a set of six numbers giving the spacecraft's location and
velocity in an appropriate inertial, orthogonal coordinate
system. In essence, an inertial coordinate system has three axes
with each pointing in a fixed direction relative to the stars. In an
orthogonal system the three axes are mutually perpendicular.
From time to time, Houston could update the onboard SV using tracking and other available date; but, generally, it was the AGC's job to update the SV at about two second intervals During coasting flight, with the engines off, the AGC used the Coasting Integration Routine (Section 5.2 in the GSOP) to update the SV. Although Earth was the dominant gravitational influence in earth orbit and, likewise the Moon in lunar orbit, the effects of both had to be included to update the SV with sufficient accuracy. The spacecraft orbit was similar to a Keplerian ellipse, but not quite identical. The Coasting Integration Routine made use of a venerable, 19th-century perturbation technique called Encke's Method.
During powered flight, the Average-G Routine was used in solving the equations of motion using (1)integrations of three-component dynamic acceleration provided by IMU Pulsed Integrating Pendulous Accelerometers (PIPAs) and (2) three-component values of gravitational acceleration.. A detailed description of the AGC can be found at Ron Burkey's comprehensive AGC site, especially the Guidance System Operations Plan (GSOP). A detailed discussion of the Average-G Routine used to update the SV during powered flight can be found in GSOP section 5.3.2.
Here is a brief description of the routine.
Let's imagine that State Vector was last updated to time, t, and had a three-component spacecraft location vector denoted r(t) and a velocity vector, v(t). The underscores indicate that r(t) and v(t) are vector quantities. In addition, the computer had a value of gravitational acceleration vector, g(t), calculated at the spacecraft location, r(t).
Since the last update, a time interval Dt has passed and the PIPAs have accumulated a dynamic, vector velocity change, Dv(Dt). Note that this velocity change does not include any effects of gravity, because the accelerometers and the spacecraft experience virtually the same gravitational pull. To begin the update, the Average-G Routine updates the location vector