Determining the initial angle of a projectile's motion

Question Q8.4.3

The trajectory of a projectile in the $xz$-plane launched from the origin at an angle $\theta_0$ from the (horizontal) $x$-axis with speed $v_0 = 25\;\mathrm{m\,s^{-1}}$ is $$ z = x\tan\theta_0 - \frac{g}{2v_0^2\cos^2\theta_0}x^2. $$

During its flight, the projectile is subject to a constant acceleration $\ddot{\boldsymbol{r}} = -g\hat{\boldsymbol{k}}$. Integrating, $$ \begin{align*} \boldsymbol{v} &= \dot{\boldsymbol{r}} = -gt\hat{\boldsymbol{k}} + \boldsymbol{v_0}\\ \boldsymbol{r} & = \textstyle -\frac{1}{2}gt^2\hat{\boldsymbol{k}} + \boldsymbol{v_0}t + \boldsymbol{r_0} \end{align*} $$ where $\boldsymbol{v_0} = (v_0\cos\theta)\hat{\boldsymbol{i}} + v_0(\sin\theta)\hat{\boldsymbol{k}}$ and $\boldsymbol{r_0}=0$ (the projectile starts at the origin). Therefore, $x = v_0t\cos\theta$ and $z = v_0t\sin\theta - \frac{1}{2}gt^2$. Eliminating $t$ from these expressions gives the formula for $z$ above.

If the projectile passes through the point $(5, 15)$, use Brent's method to determine the possible values of $\theta_0$.

Solution Q8.4.3