We now consider the more general case of moving the catapult up the hill AND changing the angle of elevation in order to reach the target. Perhaps we can determine a different angle which will still permit us to hit the target AND move the catapult up the hill less than when we fire at an angle of elevation of Pi/4 radians or 45 degrees.
Input :=
Remove[theta,x,y,xrange,dist1,dist2,vnaught]
Input :=
vnaught= 300;
x[t_, a_]=vnaught * Cos[theta] t - a;
y[t_, a_]=-16t^2 + vnaught* Sin[theta] t+ Sqrt[3]*a
-a + 300 t Cos[theta];
Output =
2
Sqrt[3] a - 16 t + 300 t Sin[theta]
And we find the range as a function of a and theta, eliminating t.
Input :=
xrange[a_,theta_] = x[t,a]/.sol[[2]];
We now determine when the range is 3000 ft and use this to write the distance a as a function of the one variable theta.
Input :=
sol = Solve[xrange[a,theta]==3000,a];
Input :=
dist1[theta_] = a/.sol[[1]];
Input :=
dist2[theta_] = a/.sol[[2]];
And we see that many combintations of angle theta and distance a along the above curve would give a path such that the projectile would hit the target at (3000,0). But could we select an angle which would minimize the distance we have to move the catapult and still hit the target at (3000, 0)?
In the case where we presume that theta = Pi/4 we got a minimum distance to move the catapult of 918.716 ft if we move to the location (-459.358, Sqrt[3] 459.358) - and we can hit the target from there.