Given the following equations and values, Find an initial theta value to maximize horizontal range with air drag.
$f(x)=\tan(\theta)*x-16+(x/(200*\cos(\theta))^2$: height with no air drag $g(x)=\tan(\theta)*x+(32/(k*200*\cos(\theta)))*x-(32/k)*\ln(200*\cos(\theta)/(200*\cos(\theta)-x))$: height with air drag $k=1/24$
I found that theta changes with time and affects the horizontal and vertical components of air drag. Initial velocity is 200. Gravity is -16. My next steps are to use concepts from differential equations and linear algebra to set up a matrix system of equation to find horizontal range in terms of theta.
I start from the vectorial equation $$m\mathbf a=m\mathbf g-mk\mathbf v$$describing the motion of a projectile, due to gravity and a resistive force proportional to the velocity.
The motion is planar with the plane of the trajectory parallel to $\mathbf g$.
Chosen a natural frame of reference with the point of projection as the origin and called $v_0$ the initial speed and $\theta$ the direction of projection, you find the cartesian equation of the trajectory$$y=x \tan \theta+x \frac g{k\,v_0\cos \theta}+\frac g{k^2}\ln\left(1-x\frac k{v_0 \cos \theta}\right)$$The non-zero $x$-solution of the equation $y=0$ gives the range of the projection.
Because $y=0$ defines (implicitly) the range $x$ as a function $x(\theta)$, differentiate the equation with respect to $\theta$ and solve with respect to $x'(\theta)$ putting this equal to zero to obtain the stationary value of $x(\theta)$.
You have $$x(kv_0+g\sin \theta)-v_0^2\cos \theta=0$$Couple the latter with $y=0$ and solve the system by a numerical method.
You find by a CAS that the maximum range $x$ is $1003.53\,$ for $\,\theta=41.85$°.
(data: $g=32,\,v_0=200,\,k=1/24\;$ in british engineering units).
Note that $\theta=45$° is the value of maximum range if the motion is unresistive.