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. $$
If the projectile passes through the point $(5, 15)$, use Brent's method to determine the possible values of $\theta_0$.
In general, there are two (physically distinct) possible angles $\theta_0$ corresponding to the projectile passing through the specified point, $(x_1, y_1) = (5,15)$, on the way up or on the way down. These values are the roots in $(0, \pi/2)$ of the function
$$
f(\theta_0; x_1, z_1) = x_1\tan\theta_0 - \frac{g x_1^2}{2v_0^2\cos^2\theta_0} - z_1
$$
After bracketing the roots with a rough plot of $f(\theta_0)$, we can use brentq
:
In [x]: g = 9.81
In [x]: v0, x1, z1 = 25, 5, 15
In [x]: f = lambda theta0, x1, z1: x1 * np.tan(theta0) - g / 2\
* (x1 / v0 / np.cos(theta0))**2 - z1
In [x]: th1 = brentq(f, 1, 1.4, args=(x1,z1))
In [x]: th2 = brentq(f, 1.5, 1.6, args=(x1,z1))
In [x]: np.degrees(th1), np.degrees(th2)
Out[x]: (74.172740936822834, 87.392310240255171)
That is, $\theta_0 = 74.2^\circ$ or $\theta_0 = 87.4^\circ$.