+
Problem 3.

-
The same functions x[t] and y[t] still give the trajectory of our cannonball, but now we need a more complex solution procedure.

-
Our solution will now consist of a launch angle and a setback distance. The distance to be optimized, the distance beyond the wall, is the total distance travelled less the setback distance. The total distance travelled is still x[t2], where t2 is the time the cannonball hits the ground. The setback distance is the distance travelled before the cannonball first achieves a height of 10 meters.

-
We find t1, time it takes to arrive at the wall as as function of theta, and then compute the distance travelled to that point, x[t1]. x[t1] is the setback distance.

-
So our distance beyond the wall given a launch angle of theta is walldistance[theta], which is the distance

-
Now we want to set the derivative of the walldistance[theta] equal to zero to find the maximum distance beyond the wall.

-
We can find a numerical solution, choosing our initial guess with the help of a plot of the function walldistance. We must be careful, because for some choices of theta, the setback distance is undefined.


In fact plotting walldistance from theta = 0 to theta = Pi/2 shows just that problem. But it also shows the reasonable value of theta for a maximum walldistance.


What can be the physical explanation for this plot?

-
Now we are ready for a numerical solution.

-
We name the optimal angle for launch thetaLaunch.

-
This says we should launch at an angle of 0.878922 radians for a distance of 52.8375 ft beyond the wall.

-
And where should we launch from, i.e. what is the setback distance from the wall? This is given by x[t1] (the distance travelled before the projectile arrives at the wall) evaluated at the time t1 (the time it takes to get from the launch position to the wall) for the given angle theta.

-
Thus we should launch some 9.82558 ft in front of the wall at an angle of 0.878922 radians for a maximum distance beyond the wall of 52.8375 ft.

-
We prepare a graphic to illustrate our final solution. We produce a graphic for the wall.

-
First we offer the path of the cannonball given the angle for maximum distance beyond the wall.

-
Then we offer the time at which the cannonball lands on the other side of the wall.

-
We generate a plot of the trajectory.

-
And finally offer a rendering of the trajectory and the wall.

-
A little cleverness can yield an exact solution. Since we know that our launch angle is between 0 and Pi/2, we can replace Cos[theta] with Sqrt[1-Sin[theta]^2] in walldistance'[theta] thus creating a function with only the "variable" Sin[theta].

-
We can replace the Sin[theta] terms with s in the above expression.

-
Since this expression is algebraic, Mathematica can solve it.

-
Since s is Sin[theta] we see that our angle (in radians) is the same as before.