Given the distance a projectile needs to travel, the initial velocity, and acceleration due to gravity, how can I calculate the launch angle?
I'm assuming $\displaystyle \Delta y = 0$.
$\displaystyle \Delta y = v_{0y}t - \frac{1}{2}gt^2$
$\displaystyle 0 = v_{0y}t - \frac{1}{2}gt^2$
$\displaystyle 0 = t(v_{0y} - \frac{1}{2}gt)$
$\displaystyle t = \frac{2v_{0y}}{g}$
$\displaystyle \Delta x = v_{x} t$
$\displaystyle \Delta x = v_{x} \cdot \frac{2v_{0y}}{g}$
$\displaystyle \Delta x = \frac{2v_0^2 \sin{\theta}\cos{\theta}}{g}$
$\displaystyle \frac{g \Delta x}{v_0^2} = 2 \sin{\theta}\cos{\theta}$
$\displaystyle \frac{g \Delta x}{v_0^2} = \sin{2\theta}$
$\displaystyle \theta = \frac{1}{2}\arcsin\left(\frac{g \Delta x}{v_0^2}\right)$
let the launch angle be $\displaystyle \theta$. now, i suppose we are launching from the ground.
you should know that $\displaystyle V_{x_0} = v_0 \cos \theta$ and $\displaystyle v_{y_0} = v_0 \sin \theta$
where $\displaystyle v_0$ is the initial velocity, $\displaystyle v_{x_0}$ is the horizontal component of the initial velocity and $\displaystyle v_{y_0}$ is the vertical component of the initial velocity. we obtained these equations by using trig ratios on the various direction vectors.
now, work in feet, since you didn't specify. so acceleration due to gravity is -32 feet per (second squared). also, s(t) is the default for the position function, v(t) is the default for the velocity function and a(t) is the default for the acceleration function.
thus, dealing with the vertical component:
$\displaystyle a_y(t) = -32$
$\displaystyle \Rightarrow v_y(t) = \int a_y(t) ~dt = -32t + C$
since $\displaystyle v_y(0) = v_{y_0} = C$ we have
$\displaystyle v_y(t) = -32t + v_{y_0}$
$\displaystyle \Rightarrow s_y(t) = \int v_y(t)~dt = -16t^2 + v_{y_0}t + D$
assuming the initial height is zero, clearly $\displaystyle s_y(0) = D = 0$
so, $\displaystyle \boxed{s_y(t) = -16t^2 + v_{y_0}t}$ ----------- this is a formula that gives us the height at time $\displaystyle t$.
dealing with the horizontal component:
$\displaystyle a_x(t) = 0$
$\displaystyle \Rightarrow v_x(t) = \int a_x(t)~dt = C$
since, $\displaystyle v_x(0) = v_{x_0} = C$, we have
$\displaystyle v_x(t) = v_{x_0}$
$\displaystyle \Rightarrow s_x(t) = \int v_x(t)~dt = v_{x_0}t + D$
since $\displaystyle s_x(0) = 0 = D$ we have
$\displaystyle \boxed{s_x(t) = v_{x_0}t}$ ---------- this is a formula for the horizontal distance traveled.
now, all of that is standard procedure, you should practice it a lot and thus be able to do all that pretty quickly with minimum thinking (always a good idea on an exam ), but here's getting to the problem
if $\displaystyle d$ is the horizontal distance traveled, then we wan
$\displaystyle s_x(t) = d$
that means $\displaystyle v_{x_0}t = d$
$\displaystyle \Rightarrow t = \frac d{v_{x_0}}$
$\displaystyle \Rightarrow \boxed{t = \frac d{v_0 \cos \theta}}$
also, for this same $\displaystyle t$, we want $\displaystyle s_y(t) = 0$ (since we want the object to hit the ground at this time. (of course if we are not going to the ground, just set $\displaystyle s_y(t) = \text{whatever}$.
so, $\displaystyle s_y(t) = -16t^2 + v_{y_0}t = 0$
$\displaystyle \Rightarrow t (-16t + v_{y_0}) = 0$
$\displaystyle \Rightarrow t = 0$ ..........this is when we start, we don't want this $\displaystyle t$
or
$\displaystyle -16t + v_{y_0} = 0$
$\displaystyle \Rightarrow t = \frac {v_{y_0}}{16}$
$\displaystyle \Rightarrow \boxed{t = \frac {v_0 \sin \theta}{16}}$
now remember, these $\displaystyle t$'s are the same, so we can equate them. thus, we have
$\displaystyle \frac {v_0 \sin \theta}{16} = \frac d{v_0 \cos \theta}$
$\displaystyle \Rightarrow v_0^2 \sin \theta \cos \theta = 16d$
$\displaystyle \Rightarrow \sin \theta \cos \theta = \frac {16d}{v_0^2}$
$\displaystyle \Rightarrow \frac 12 \sin 2 \theta = \frac {16d}{v_0^2}$
$\displaystyle \Rightarrow \sin 2 \theta = \frac {32d}{v_0^2}$
$\displaystyle \Rightarrow \boxed{\theta = \frac 12 \sin^{-1} \left( \frac {32d}{v_0^2} \right)}$
there has to be an easier way to get to that formula. but i am not in a thinking mood now, obviously. i just followed a standard method
EDIT: there, skeeter has the shorter way he ends up using formulas that i derived. i should have remembered those formulas!
This isn't a huge deal. I actually don't need an easy way to get this formula just as long as it works. This is actually for a video game programming class which I need this formula for in order to write code that works properly. I took physics over 2 years ago and have forgotten A LOT.
A quick question though: where did the -16 come from in step 2? Is this just (acceleration due to gravity)/2 and if so can I plug in 9.81/2 if i am using meters as my units?
Thanks again
i would just use what skeeter did. they are standard physics formulas. i've never done physics, which is why i didn't remember them
the -16 comes from integrating -32t. the integral of t is (t^2)/2, that 2 divided into the -32 to give -16
anyway, if you are using a program, just program the formulas that skeeter gave. pretty all my boxed formulas but the last one is given by some physics formula. why re-invent the wheel?