Catapult Problem

A medieval city has the shape of a square and is protected by walls with length 500 =10*50 meters and height 15 meters.You are the commander of an attacking army and the closest you can get to the wall is 100 meters.Your plan is to set fire to the city by catapulting heated rocks over the wall with an initial speed of 80 meters per second.At what range of angles should you tell your men to set the catapult?Assume that you will be firing from exactly 100 meters from the wall and that you will be firing perpendicular to the wall.We also assume that the walls of the city are impervious to heated rocks.

The projectile sometimes hits the front wall - and therefore doesn’t get into the city. The projectile sometiimes goes past the back wall and doesn’t get into the city.

There is a range of angles that we are looking for
From (0,(Subscript[θ, 1])) the projectile hits the front wall.
From ((Subscript[θ, 1]),(Subscript[θ, 2])) the projectile makes it into the city.
From ((Subscript[θ, 2]),(Subscript[θ, 3])) the projectile misses the city and flies past the back wall.
From ((Subscript[θ, 3]),(Subscript[θ, 4])) the projectile again hits the interior of the city.
From ((Subscript[θ, 4]),90) the projectile does not make to to the front wall.

The Model

Parametric Equations for the Path of the Projectile

x=80*t*cos⟨θ⟩
y=80*t*sin{θ} - 4.9*(t^2)

v0=80;
Manipulate[ParametricPlot[{{v0 t*Cos[theta],v0 t*Sin[theta]-4.9
t^2},{100+10t,15}},{t,0,50},PlotRange->{{0,700},{0,300}},AspectRatio->3/2],{theta,0,Pi/2}]

Front Wall

When will the projectile clear the front wall?

The projectile will hit the top of the front wall when x = 100 and when y = 15.

Solve[{80.*t*Cos[theta]==100 ,80t*Sin[theta]-4.9t^2==15},t]

NSolve[{80*t*Cos[theta]==100,80t*Sin[theta]-4.9
t^2==15},{t,theta}]

The two solutions for which 0 < theta <π/2 are theta=0.2267 and 1.4930.  In degrees:

t1deg=0.226671/Pi*180

t2deg=1.49301/Pi*180

So we need our angles to be larger than 12.99 degrees and less than 85.54 degrees.

These two angles are (Subscript[θ, 1])and (Subscript[θ, 4]).

Back Wall

When will the projectile go past the back wall?

The projectile will hit the top of the back wall when x = 600 and when y = 15

NSolve[{80*t*Cos[theta]==600,80t*Sin[theta]-4.9
t^2==15},{t,theta}]

Again, we’re looking for solutions where 0 < theta <π/2

t1deg=0.628949/Pi*180

t2deg=0.966842/Pi*180

We have just computed (Subscript[θ, 2])and (Subscript[θ, 3]).

Conclusion

Therefore

For angles between (0, 12.99°) the projectile strikes the front wall and misses the city.

For angles between (12.99°, 36.04°) the projectile makes it into the city.

For angles between (36.04°, 55.40°) the projectiles clears the city and strikes the ground past the back wall.

For angles between (55.40°, 85.54°) the projectile again strikes the city.

For angles between (85.54°, 90°) the projectile hits the ground in front of the front wall.