Solution (source code)

= Solution

A <gravitational field> is <force> per unit test <mass>, $\mathbf g=\mathbf F/m$. <Newton's law of universal gravitation> gives the field of a <point mass> M:
$$
\boxed{\mathbf g=-\frac{GM}{r^2}\widehat{\mathbf r},\qquad
\Phi=-\frac{GM}{r},\qquad\mathbf g=-\nabla\Phi.}
$$
The potential is <potential energy> per unit <mass>, with zero at infinity for an isolated <mass>. Fields and potentials superpose. The potential difference fixes the work per unit <mass>, and a conservative <gravitational field> has zero circulation around a closed path.

For a continuous <mass distribution>, the gravitational Gauss law is $\oint\mathbf g\cdot d\mathbf S=-4\pi GM_{\rm enc}$. A spherical body therefore has the same exterior field as a <point mass> at its centre. Inside a uniform sphere of <density> $\rho$,
$$
\mathbf g=-\frac{4\pi G\rho}{3}\mathbf r.
$$
The field is continuous at its surface and vanishes at its centre. An empty spherical shell has zero interior field but a nonzero constant interior potential. Near a small region of <Earth>'s surface one may approximate $\mathbf g$ as uniform and the potential change as $g\Delta h$. Farther away its spatial <gradient> produces tidal relative <accelerations>. Escape to infinity from radius R requires <speed> $\sqrt{2GM/R}$ when rotation and other bodies are neglected.