## Friday, April 17, 2015

### Maximizing The Trajectory Of A Projectile

Suppose we are asked to compute the launch angle which will maximize the arc-length of the trajectory for a projectile, assuming gravity is constant and is the only force on the projectile after the launch.

Eliminating the parameter $t$, we find the object's trajectory will be given by:

$\displaystyle y=\tan(\theta)x-\frac{g\sec^2(\theta)}{2v_0^2}x^2$

$\displaystyle \frac{dy}{dx}=\tan(\theta)-\frac{g\sec^2(\theta)}{v_0^2}x$

$\displaystyle s=\int_0^{\frac{v_0^2}{g}\sin(2\theta)}\sqrt{1+\left(\frac{dy}{dx} \right)^2}\,dx$

At this point I wanted to be slick and use the derivative form of the FTOC to differentiate directly, but I couldn't make it work. :lol:

So, here goes...

Let:

$\displaystyle u=\frac{g}{v_0^2\sin(2\theta)}x\:\therefore\:du=\frac{g}{v_0^2\sin(2\theta)}\,dx$

and we have:

$\displaystyle 1+\left(\tan(\theta)-\frac{g\sec^2(\theta)}{v_0^2}x \right)^2=1+\left(\tan(\theta)-2\tan(\theta)u \right)^2=\frac{\cos^2(\theta)+\sin^2(\theta)(1-2u)^2}{\cos^2(\theta)}=$

$\displaystyle \frac{\cos^2(\theta)+\sin^2(\theta)(1-4u+4u^2)}{\cos^2(\theta)}=\frac{\cos^2(\theta)+\sin^2(\theta)-4u\sin^2(\theta)+4u^2\sin^2(\theta)}{\cos^2(\theta)}=$

$\displaystyle \frac{1-4u\sin^2(\theta)(1-u)}{\cos^2(\theta)}$

And now we may write:

$\displaystyle s=\int_0^1\sqrt{\frac{1-4u\sin^2(\theta)(1-u)}{\cos^2(\theta)}}\,\frac{v_0^2\sin(2\theta)}{g}\,du$

$\displaystyle s=\frac{2v_0^2\sin(\theta)}{g}\int_0^1\sqrt{1-4\sin^2(\theta)u(1-u)}\,du$

If we observe that this integral is symmetric about the line $\displaystyle u=\frac{1}{2}$, we may write:

$\displaystyle s=\frac{4v_0^2\sin(\theta)}{g}\int_0^{\frac{1}{2}}\sqrt{1-4\sin^2(\theta)u(1-u)}\,du$

Let:

$\displaystyle v=4u(1-u)\:\therefore\:dv=4(1-2u)\,du=4\sqrt{1-v}\,du$ and we have:

$\displaystyle s=\frac{v_0^2\sin(\theta)}{g}\int_0^1\sqrt{\frac{1-\sin^2(\theta)v}{1-v}}\,dv$

Let:

$\displaystyle w=\sqrt{\frac{1-\sin^2(\theta)v}{1-v}}\:\therefore\:dw=\frac{(w^2-\sin^2(\theta))^2}{2\cos^2(\theta)w}\,dv$

and we have:

$\displaystyle s=\frac{2v_0^2\sin(\theta)\cos^2(\theta)}{g}\int_1^{\infty}\frac{w^2}{(w^2-\sin^2(\theta))^2}\,dw$

Let:

$\displaystyle w=\sin(\theta)\csc(\alpha)\:\therefore\:dw=-\sin(\theta)\csc(\alpha)\cot(\alpha)\,d\alpha$

and we have:

$\displaystyle s=\frac{2v_0^2\cos^2(\theta)}{g}\int_0^{\theta}\sec^3(\alpha)\,d\alpha$

With a bit of algebra, we may write this in a form we may integrate directly:

$\displaystyle \sec^3(\alpha)=\frac{1}{2}(\sec^3(\alpha)+\sec^3(\alpha))=\frac{1}{2}(\sec^3(\alpha)+\sec(\alpha)(\tan^2(\alpha)+1))=$

$\displaystyle \frac{1}{2}\left(\sec^3(\alpha)+\sec(\alpha)\tan^2(\alpha)+\sec(\alpha)\frac{\tan(\alpha)+\sec(\alpha)}{\tan(\alpha)+\sec(\alpha)} \right)=$

$\displaystyle \frac{1}{2}\left(\sec(\alpha)\sec^2(\alpha)+\sec(\alpha)\tan^2(\alpha)+\frac{\sec(\alpha)\tan(\alpha)+\sec^2(\alpha)}{\sec(\alpha)+\tan(\alpha)} \right)=$

$\displaystyle \frac{1}{2}\frac{d}{d\theta}\left(\sec(\alpha)\tan(\alpha)+\ln\left|\sec(\alpha)+\tan(\alpha) \right| \right)$

and so we have (given $\displaystyle 0<\theta<\frac{\pi}{2}$):

$\displaystyle s=\frac{v_0^2\cos^2(\theta)}{g}\int_0^{\theta}\,d\left(\sec(\alpha)\tan(\alpha)+\ln(\sec(\alpha)+\tan(\alpha)) \right)$

$\displaystyle s(\theta)=\frac{v_0^2\cos^2(\theta)}{g}\left(\sec(\theta)\tan(\theta)+\ln(\sec(\theta)+\tan(\theta)) \right)$

$\displaystyle s(\theta)=\frac{v_0^2}{g}\left(\sin(\theta)+\cos^2(\theta)\ln(\sec(\theta)+\tan(\theta)) \right)$

Now, differentiating and equating to zero, we find:

$\displaystyle s'(\theta)=\frac{v_0^2}{g}\left(\cos(\theta)+\cos^2(\theta)\frac{\sec(\theta)\tan(\theta)+\sec^2(\theta)}{\sec(\theta)+\tan(\theta)}-2\cos(\theta)\sin(\theta)\ln(\sec(\theta)+\tan(\theta)) \right)=0$

$\displaystyle s'(\theta)=\frac{2v_0^2\cos(\theta)}{g}(1-\sin(\theta)\ln(\sec(\theta)+\tan(\theta)))=0$

And so we find we want to satisfy:

$\displaystyle f(\theta)=\sin(\theta)\ln(\sec(\theta)+\tan(\theta))-1=0$

Using Newton's method, we will need:

$\displaystyle f'(\theta)=\tan(\theta)+\cos(\theta)\ln(\sec(\theta)+\tan(\theta))$

And so Newton's method gives us the recursion:

$\displaystyle \theta_{n+1}= \theta_n-\frac{\sin(\theta_n)\ln(\sec(\theta_n)+\tan(\theta_n))-1}{\tan(\theta_n)+\cos(\theta_n)\ln(\sec(\theta_n)+\tan( \theta_n))}$

Using $\displaystyle \theta_0=\frac{\pi}{4}$ as the first guess, we find:

$\theta_1\approx1.01751306067$

$\theta_2\approx0.986290147513$

$\theta_3\approx0.985515191499$

$\theta_4\approx0.985514737863$

$\theta_5\approx0.985514737862$

$\theta_6\approx0.985514737862$

Converting from radians to degrees, we find the launch angle which maximizes the arc length is:

$\theta\approx56.4658351275^{\circ}$