Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given a coordinate and the launch speed, I need to determine which pair of angle, or angle allows a hit on said coordinate. I know, let's say, the common way, which is using the following equations:

$$ x = V_ocos(\theta)t $$ $$ y = V_osen(\theta)t - \frac{gt^2}{2} $$

And after removing the parameter:

$$ y = tan(\theta)x - \frac{gx^2}{2{V_o}^2cos^2\theta} $$

And solving for $tan(\theta)$: $$ tan(\theta) = \frac{\frac{2{V_o}^2}{gx} \pm \sqrt{(\frac{2{V_o}^2}{gx})^2 - 4(\frac{gx^2+{2V_o}^2}{gx^2})}} {2} $$

Now, that's big, plus there's too much margin for error. Do you know a better way to calculate the angle(s) of launch which hits $(x,y)$?

Thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

What do you mean by "too big"? It seems quite reasonable to me.

If you are worried about cancellation in an expression of the form $a \pm \sqrt{a^2-b}$, use the standard technique of computing the root with the sign of the $\sqrt{}$ having the same sign as $a$, and then use $(a \pm \sqrt{a^2-b})(a \mp \sqrt{a^2-b}) = a^2 - (a^2-b) = b $ to get the other root.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.