This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

A particle is fired from ( 0 , 0 ) with velocity v at angle theta. It is to hit an object at ( x , y ).

in the x direction we have:

x = v * cos( theta ) * t

in the y direction we have:

y = v * sin( theta ) * t - 1/2 * g * t^2

The question is this: solve for theta. It seems like the first thing an artilleryman ought to know, but I can't manage to do it. (The TI-89 couldn't hack it either, so I feel a little better). If I solve for t in the x equation, I get a nightmare of trig. If I solve for theta, and then use a right triangle to get rid of all the trig, I get a mess of sqare roots and squares that I can't simplify. I'd love for any help I can find around the 'ranch. I'm hoping I can get Jim on the job...

I've heard it takes forever to grow a woman from the ground

[Paul]: Did your picture get worse between when you posted it and now?

That seems... doubtful...

The answer doesn't depend on v? I find that a bit odd.

Ah, but your answer does depend on t, which was not part of the initial conditions, and which will depend on x, y, v, and of course g. So by the time you fully eliminate t, the answer will again depend on v.

[Nick]: If I solve for t in the x equation, I get a nightmare of trig.

Unfortunately, I think that's the best route to take here. Eliminate t by solving for it in one equation and substituting into the other. After that - it's pretty icky. The half-angle formulas from trigonometry are probably useful here - you can rewrite the various trig functions so they're all in terms of cos 2θ (or possibly cos 4θ, depending how you do it) then make some substitution like u = cos 2θ (if only to cut down on writing) and keep simplifying.

Alternately, I expect there's a complete formula and derivation in most university intro Physics textbooks (for the calculus-based intro courses, at least - the solution doesn't require calc but it's of comparable complexity). Or it's probably online somewhere, though it didn't jump out in a few quick googles. I worked through it once, but as I recall it's one of the more complex derivations in [supposedly] "basic" projectile motion.

it seems like the first thing an artilleryman ought to know

Yeah, but most of them just memorized the final formulas. Actually working them out on the spot would've been a bit much to expect, especially in the midst of battle. For extra fun, throw in centrifugal forces, Coriolis forces, and air resistance. [ January 12, 2006: Message edited by: Jim Yingst ]

it seems like the first thing an artilleryman ought to know

Yeah, but most of them just memorized the final formulas. Actually working them out on the spot would've been a bit much to expect, especially in the midst of battle. For extra fun, throw in centrifugal forces, Coriolis forces, and air resistance.

This problem was one of the great early motivators for military funding of computing research. Killing people with math. Shudder.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671

posted

0

[Nick]: I thought 'code' tags preserved spacing.

The spaces are there, but whether or not they're rendered in monospace font is the issue. UBB has some bugs in this area, rendering nonstandard HTML which is interpreted differently by different browsers. I believe IE, Safari and Opera render the monospace consistently, while Firefox may not. Since the font tags are nested incorrectly to begin with, I'm not sure this is can be called a Firefox bug. The rendering also seems to depend on the content of other posts on the page, in a way I don't understand.

Most of the time this isn't a big issue - in code for example, it doesn't matter if the initial spaces are monospace or not, as long as all the indentation is done in spaces. The relative indentation of the beginning of each line of code works out the same. But in an ASCII diagram where we depend on the relative position of characters not at the beginning of a line, the problem becomes more noticeable.

[Paul C]: And yeah, the answer not depending on v wasn't just "a bit odd", it should have been a big red flag.

To be fair, it's not unheard of for variables to drop out unexpectedly. The fact that the period of a simple pendulum is unaffected by its length, for example. So I think I can see where you were coming from...

The fact that the period of a simple pendulum is unaffected by its length

At the risk of stepping into a big one...

I thought that the length was the ONLY factor that affected a pendulum's period? (In other words the weight of the bob, the angle of the swing, etc. don't affect the period.)

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671

posted

0

D'oh!

Yes, that's what I was thinking, unfortunately not what I actually said. Oopsie.

The nasty looking trig you get when you eliminate t can be turned into a quadratic in tan theta using:

1) sin / cos = tan 2) 1 / cos^2 = 1 + tan^2

You can then just calculate your coefficients and plug into the normal quadratic formula to get two values for tan theta.

SCJP SCWCD

Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815

posted

0

Ok!

So!

Now, I know that t > 0, so I can just take the principle square root of t² to get t. If I want the projectile to hit at the earliest possible time (i.e. on the way up), do I want the discriminant in the t² to be plus or minus? My preliminary investigations suggest it depends on what's bigger than what and by how much.

Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815

posted

0

Originally posted by Jon Pincott: The nasty looking trig you get when you eliminate t can be turned into a quadratic in tan theta using:

1) sin / cos = tan 2) 1 / cos^2 = 1 + tan^2

You can then just calculate your coefficients and plug into the normal quadratic formula to get two values for tan theta.

Wow... just saw that. That works brilliantly, no half angles or nuthin'. Thanks.

Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815

posted

0

I'm hoping I can get my math checked now.

I get a = gx/v^2, b = vx, and c = gx/v^2 - y. If

tan theta = -b +/- root(b^2- 4ac) ...........--------------------- ....................2a,

here are the results:

the plus one is garbage- my guy always shoots straight up. Don't know why it's garbage, but it is.

the minus one is not quite garbage, but almost. First off, for some reason it's in the wrong direction, so I say pi - that. Then, it always under shoots by a bit. I'm beginning to think it's the fault of my program and not the math, but I hope someone will look over my math.

Thanks, Nick.

Jon Pincott
Greenhorn

Joined: Jul 28, 2004
Posts: 17

posted

0

Nick, I get something different for my coefficients:

u can eliminate one of these by some argument like: if it is negative or > 90 degrees

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671

posted

0

[Sam]u can eliminate one of these by some argument like: if it is negative or > 90 degrees

That seems unlikely, as there will generally be two solutions in the range 0-90 degrees. One represents a more direct shot, the other represents a high lob. Usually you'd want the direct shot unless there are mountains or other impediments in the way.