Solution (source code)

= Solution

Let $C$ be the centre of the Earth and let $M$ be its mass. Since $CW=R$ and $CS=R+l$, the <law of cosines> in triangle $CSB$ gives the ball's initial distance from $C$ as
$$
r_B=CB=\sqrt{(R+l)^2+l^2-2l(R+l)\cos\theta_0}.
$$
The surface value of the <Newtonian gravitational field> satisfies $g=GM/R^2$. Using the <Newtonian gravitational potential energy> $-GMm/r$, <conservation of energy> now gives
$$
\frac12mv_2^2=GMm\left(\frac1R-\frac1{r_B}\right).
$$
Therefore
$$
\boxed{v_2=\left[2gR^2\left(\frac1R-\frac1{\sqrt{(R+l)^2+l^2-2l(R+l)\cos\theta_0}}\right)\right]^{1/2}}.
$$