A small material particle of mass m kg is thrown from the height of H meters above the ground level towards a fence of height h m located l meters from the projectile initial location. The magnitude of the initial velocity (speed) is V m/sec.
Find the angle α with the horizontal at which the projectile should be thrown in order to just clear the top of the fence. Plot a trajectory of the projectile. If there are more than one trajectory satisfying the conditions of the problem, plot all of them in one figure. Assume that the effect of air resistance is negligible. Use the gravitational acceleration
Solve the problem interactively, step by step with specific parameters H = 2; h = 3.5; l = 20; V = 15.
Step 1: Solving the equations of projectile motion
Use Newton's Second Law m∗a=F to set up the ODEs for the horizontal and vertical components of position x(t),y(t) of the projectile. Find the genearal solutions to the ODEs. Then determine the four arbitrary constants in this general solution using the initial conditions for position and velocity.
The solution involves unknown direction α of the initial velocity.
<built-in function reset>
### Your solution for Step 1 goes herex0=0;y0=2;l=20;h=3.5;V=15;H=2;g=9.81var('alpha')# Governing equations: m*x'=0, m*y'=-m*g.# Initial conditions:x0=0,y0=H,vx=V*cos(alpha),vy=V*sin(alpha)# Solution:x(t)=V*cos(alpha)*ty(t)=-g*(t^2/2)+V*sin(alpha)*t+H
Step 2: Finding the time when projectile reaches the fence
Use x(t) to find the time tfence when the projectile reaches the fence location, that is, when
# You code goes here# Write the equation x(tfence)=(fence location) using solution x(t) found on Step 1#Solve the equaiton for tfencetfence=l/(V*cos(alpha));tfence# tfence involves the unknown parameter $\alpha$.
Step 3: Setting up the equation for α and finding α
The height y(tfence) must be equal to the height of the fence: y(tfence)=h
# Write the equation y(tfence)=h using th solution for y(t) found on Step 1. eq=y(tfence)==h;eq
#Use the identity 1/cos(s)^2=1+tan(s)^2 to rewrite the equation as quadratic with respect to $z=tan(alpha)$ and solve for $z$. Use the dictionary type for your solution.var('z')eq_z=20*z-8.72*(1+z^2)-1.5==0tan_alpha=solve(eq_z,z,solution_dict=True);tan_alpha
# Now use the inverse of the function and find alpha1 and alpha2 from equation tan(alpha)=zalpha1=(arctan(tan_alpha[z])).n()alpha2=(arctan(tan_alpha[z])).n()
Step 4: Plotting the trajectories of the projectile
#Define parametric equations of the two trajectories#First trajectory:y1(t)=y(t).subs(alpha=alpha1);x1(t)=x(t).subs(alpha=alpha1)#Second trajectoryy2(t)=y(t).subs(alpha=alpha2);x2(t)=x(t).subs(alpha=alpha2)#For each trajectory find the time when projectile hits the ground. Experiment with time range to bracket the solution or just play with plots to find the needed rangetfinal1=find_root(y1(t),0,4)tfinal2=find_root(y2(t),0,4)