aspose file tools*
The moose likes Programming Diversions and the fly likes Cannon fire Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Cannon fire" Watch "Cannon fire" New topic
Author

Cannon fire

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Two identical cannons fire at each other, one on a hill the other on level ground. Their shells are fired simultaneously at exactly the same speeds. Ignoring wind resistance , will they hit each other or will they miss.


[ November 18, 2003: Message edited by: HS Thomas ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Depends what "at each other" means. Were the canons aimed by someone who knows how to correct for gravity (and optionally, Coriolis forces)? Or did they just point "straight" at the other cannon and think that would work?
I suppose if both aims are exactly correct and we ignore Coriolis forces, you get two cannonballs colliding in midair. With Coriolis, the paths might diverge enough for the balls to miss each other (depending on latitude, longitude, range, and cannonball diameters). Though it would be a bit odd to include Corilios forces after discounting air resistance, unless maybe the cannon are on the Moon.


"I'm not back." - Bill Harding, Twister
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

more information than that is still needed. what if the velocity is barely enough to have the lower cannonball escape the muzzle? and the other cannon is 1 mile in the air? clearly, the ball from the lower cannon will hit the ground in about 1 second, while the other won't reach earth for a good minute or so...


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Originally posted by Jim Yingst:
Depends what "at each other" means. Were the canons aimed by someone who knows how to correct for gravity (and optionally, Coriolis forces)? Or did they just point "straight" at the other cannon and think that would work?

The latter, first.
Afterwards, consider Coriolis forces, if you please.
I think we'll keep the moon out of it for now. Did you know the moon's receding from us by a fraction of an inch every year ?

regards
[ November 18, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Originally posted by fred rosenberger:
more information than that is still needed. what if the velocity is barely enough to have the lower cannonball escape the muzzle? and the other cannon is 1 mile in the air? clearly, the ball from the lower cannon will hit the ground in about 1 second, while the other won't reach earth for a good minute or so...

I think they'd have worked out how much velocity was needed for the cannon balls to get to the cannon at the other end. The question is whether the cannon balls will hit or miss each other mid air.
The force of gravity applies to this question.
regards
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Jim]: Or did they just point "straight" at the other cannon and think that would work?
[HS]: The latter, first.

Well, pointing "straight" without bothering to take gravity into consideration, they'd miss, unless they're really close, because, well, gravity makes things fall. Although if the ground is hard and flat enough, the cannonballs may simly roll along the ground to hit the target that way.
Assuming they're manned by competent crew who do understand gravity at least... hmmm, I had already answered this, but I now see that I'd missed the fact that one cannon was higher than the other. OK, that asymmetry should be sufficient to significantly reduce the chance of midair collision, since the two trajectories probably don't intersect except at the endpoints. In theory we can guarantee that if both cannon have the same starting velocity, but different altitudes, the two firing solutions for high-shoots-low will not overlap the two solutions for low-shoots-high. Though if the cannonball is big enough, and altitudes are similar enough, the trajectories may be close enough for the cannonballs to hit each other, despite being on differnet paths.
[fred]: more information than that is still needed. what if the velocity is barely enough to have the lower cannonball escape the muzzle? and the other cannon is 1 mile in the air?
Well, that falls under correcting for gravity. To aim properly correcting for gravity, you need to know muzzle speed. I assume that whatever the speed is, it's sufficient for the lower cannon to reach the upper cannon, otherwise we can't say that the crew have corrected for gravity. Which gets us back to: if the crew can't aim properly, they'll probably miss. Which isn't really news, right? I'm not sure what the question really is here...
[ November 18, 2003: Message edited by: Jim Yingst ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by HS Thomas:
Afterwards, consider Coriolis forces, if you please.

Heh, trouble maker
Q: Two people holding swords stand on separate spinning tables (person spinning clockwise, B anti-clockwise) and make vertical chops at each other. Do they
A) Hit.
B) Miss.
C) Manage to rip their own arms off.
Oops, off topic.
I think it may be important whether the lower ball has a chance to begin its decent. Haven't done any maths yet, too busy
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
trouble maker
Why? I thought you guys had special experience with Coriolis forces down there, what with the backwards toilets and all.
Two people holding swords stand on separate spinning tables
Or for fun, we could consider an artillery duel with particpants on opposite sides of the equator.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Jim Yingst : Well, pointing "straight" without bothering to take gravity into consideration, they'd miss, unless they're really close, because, well, gravity makes things fall.

Well consider this answer.
The cannon balls will hit each other.
Here's how. The cannon balls will start out in a straight line towards each other but then each ball is pulle doff this course by the force of gravity. However each ball will fall from this line of fire by the same amount as the other and so a collission is inevitable. Inevitable as noted unless drawn off course by air resistance or unless the cannons are completely out of rangre of each other.



The Coriolus forces effect looks interesting.
regards
[ November 19, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Originally posted by David O'Meara:

Heh, trouble maker

Named Jim.

Q: Two people holding swords stand on separate spinning tables (person spinning clockwise, B anti-clockwise) and make vertical chops at each other. Do they
A) Hit.
B) Miss.
C) Manage to rip their own arms off.


I wondered what the Coriolis effect was ?
regards
[ November 19, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Though if the cannonball is big enough, and altitudes are similar enough, the trajectories may be close enough for the cannonballs to hit each other, despite being on differnet paths.

So if one cannon is fired from the top of Mt Everest and the other cannon is placed anywhere at sea level, the cannonballs have to be sufficiently big and sufficiently close to hit each other. How big and how close ?

I think as far as the question goes, that the cannons were large enough to fire at each other following a straight line is sufficient.
I could have overlooked something.
regards
[ November 19, 2003: Message edited by: HS Thomas ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Well consider this answer.
The cannon balls will hit each other.

True for this case. (Clueless aiming, with gravity but no Coriolis.) I didn't really pay much attention to what would happen after they were fired, since it was clear they weren't actually going to hit the targets. Why would anyone "aim" cannon in this manner?
Inevitable as noted unless drawn off course by air resistance
Or Coriolis forces.
So if one cannon is fired from the top of Mt Everest and the other cannon is placed anywhere at sea level, the cannonballs have to be sufficiently big and sufficiently close to hit each other. How big and how close ?
We'd also need to know latiude & longitude, and muzzle velocity. We know where Mt. Everest is, but the C-forces depend on where the target is too, and how fast you're traveling. And we'd have to find someone who cared enough to do a numeric sumulation of the forces involved. Though if we're still ignoring wind then we might just forget C-forces and use elliptical orbits instead; might be cleaner.
I think as far as the question goes, that the cannons were large enough to fire at each other following a straight line is sufficient.
I could have overlooked something.

With idealized simplistic aiming + gravity, the two trajectories would intersect exactly, in the middle; cannonball size is irrelevant. With proper aiming that accounts for gravity &/or C-forces, the trajectories intersect at the endpoints (at the targets) rather than in the middle, and size woudlbe relevant for figuring out near misses. Also we'd need to know if the cannon were firing "lobs" or relatively straight shots, since there are generally two angles you can fire at to hit a target with a given muzzle velocity. Cannon would generally use the straightest shot possible; artillerists might well use a high lob.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Thanks for the response, Jim.
The factors to consider seem to be :
C-forces.
wind resistance
elliptical orbits
latitude & longitude (not sure why)
Lots of food for thought till someone bites..


regards
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

don't know how relevent (sp?) this is, but...
years ago, in college physics, the prof did an experiment. they had an air-powered gun that would shoot a ball-bearing. the "gun" was aimed at a card-board monkey, hanging (magnetically) from a "tree". at the exact momnet the ball bearing left the muzzle, the circuit was cut, and the monkey would drop to the ground.
the ball bearing hit the monkey every time, mid-air. this implies that if you just dropped the upper cannon-ball straight down, the two would collide mid-air (ignoring coreolis effect) (forgive my spelling - no coffee yet).
but the upper cannon-ball is given an initial downward velocity, so it should be lower than the "monkey". But, it's also given a lateral velocity, so while it will be lower sooner, it will also be moving towards the other shot.
without doing any math or physics, just extrapolating from that experiment, i'd say they hit.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
A cardboard monkey and fired upper cannon ball in the first question are
two different things.
The downward fall of the cardboard monkey is purely under gravity, right ?
The cannon ball fired in the second example has a downward velocity and it's path is dampened by gravity.
Fred, there must be some conditions, under which only, will they collide, IMHO.

The object dropping straight down would have to fall much slower than the one being fired, for instance.

regards
[ November 19, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Perhaps not considering Corilius forces and air resistance ain't very useful.
The following principles are needed before starting :
  • Newton's First Law in component form - Objects in motion tend to stay in motion unless acted on by an unbalanced force. A vector component of velocity will not be changed by a force perpendicular to that component.
  • Spherical Geometry of the Earth - X degrees of longitude gives you different distances between longitude lines (in miles or kilometers) at different latitudes, plus a few additional results of being on a sphere.
  • Gravity - Objects under the influence of Earth's gravity will fall towards (and thus orbit) the center of mass of the Earth.



  • That's where lats and longs come in. :roll:

    regards
    fred rosenberger
    lowercase baba
    Bartender

    Joined: Oct 02, 2003
    Posts: 11314
        
      16

    yes, the object fired down would fall faster than the monkey, but i assumed (very possibly incorrectly) that the fired object's lateral motion would compnesate somehow... not for any formal reason, just because this sounds like the kind of trick question where you say "no, they'd never hit", and then the PhD in physics says "AH, but they WILL!!!"
    but look at it this way. assume no gravity. the balls will collide, yes?
    relative to each other, the balls have NO vertical velocity. one is going up at the same rate the other is going down.
    now, add gravity. it effects both equally. so the relative vertical velocity has to still be zero... so they will still collide
    Jim Yingst
    Wanderer
    Sheriff

    Joined: Jan 30, 2000
    Posts: 18671
    [HST]: The factors to consider seem to be :
    C-forces.
    wind resistance
    elliptical orbits
    latitude & longitude (not sure why)

    Well first I should back up a bit. If we consider Coriolis forces, we should also consider centrifugal force from the earth's rotation. Both these forces are directly tied to the earth's rotation, but they're in different directions. Neither of these are "real" forces in the sense that if we boserver from a nonroatating frame of reference, they don't exist, and we can say that the only forces on the cannonballs are garvity and air resistance. But since in practice we're on a rotating frame of reference, namely the Earth, it's sometimes practical to go ahead and indulge in talking about these "fictitious" Coriolis and centrifugal forces. If you're using a rotating frame of references, objects seem to behave as though they're affected by these two forces, in addition to gravity and air resistance. So they're real enough in that sense.
    As for elliptical orbits - they only look like ellipses in a nonrotating frame of reference, and they're the result of gravity. It's not a separate effect. It's possible to "step back" and talk about the problem as if you're observing from space (e.g. from a nonrotating space station) and then (if there were no air resistance) the cannonball trajectories would be perfect ellipses. But in this case, you also have to talk about the fact that the cannons themselves are moving, as they rotate around the axis of the earth. It can get a bit confusing.
    Going back to the rotating frame of reference, with Coriolis and centrifugal forces, as well as gravity, there was a question about latitude and longitude. Latitude is certainly necessary to calculate either centrifugal or Coriolis forces. E.g. if you're at the equator there's more centrifugal force than if you're at a pole. Likewise Coriois forces are affected by latitudes. Longitude isn't so imporatant, but we need to know how far we're traveling east-west as well as north-south, so knowing longitudes would be one way of establishing that. Unlike latitude though, we really only need the difference in longitudes between the two cannon.
    Anyway, that's enough from me. I have no plans to do any actual calculations with more realistic forces as they're pretty complex, and the original question seems to be answered already. Just wanted to clarify some of the earlier points though...
    HS Thomas
    Ranch Hand

    Joined: May 15, 2002
    Posts: 3404
    Originally posted by Jim Yingst:
    It can get a bit confusing.
    You don't say !
    Anyway, that's enough from me.

    Awww. I might feel challenged I found this real simple explanation on C-forces. But duty calls AWP.
    Thanks for the input, Jim. I didn't know what I was getting into with the original question.

    regards
    [ November 19, 2003: Message edited by: HS Thomas ]
    David O'Meara
    Rancher

    Joined: Mar 06, 2001
    Posts: 13459

    I managed to prove 0=0 (is this the problem?)
    I also managed to prove a boundary condition:
    Reasoning: If they aim at each other and have the same muzzle velocity, the horizontal compontents of the velocities are the same. Assuming no external influences, if the balls were going to hit, it would be mid way along the x axis.
    Labeling the triangle sides as x, y and the hypotenuse as 'd', and the bottom angel as 'a' (I wanted alpha, but I'm not keep on cutting and pasting all those characters)
    Now we have x=d*cos(a), y=d*sin(a)
    Horizontal speed is v<sub>x</sub>=v*cos(a)
    Calling the top cannon location A and the bottom B, if B arcs then lands on the midpoint (x/2,0), the time to get there is
    t = dist/velocity = (x/2)/v*cos(a) = (d*cos(a))/(2*v*cos(a)) = d/(2v)
    During this time, we know that the vertical distance=0 (it leaves the ground and hits the ground again)
    s=ut+1/2*at^2
    0 = v*cos(a) * (d/2v) - 1/2 * g * (d/2v)^2 (gravity is the opposite direction to the intial velocity)
    solving for v gives v=(gd/(8sin(a))^(1/2)
    So if the cannon at A fires a ball at the same velocity, how far does it fall?
    s=ut+1/2at^2
    (maths maths maths)
    s = 1.5y => it has already hit the ground.
    David O'Meara
    Rancher

    Joined: Mar 06, 2001
    Posts: 13459

    Just to re-state:
    The above shows that they don't hit the ground at the same time at the mid point. It does not prove that they cannot hit each other given some other initial velocity.
    When I tried the first time to find a velocity in terms of d and a where they hit, I got 0=0...
    HS Thomas
    Ranch Hand

    Joined: May 15, 2002
    Posts: 3404
    Assuming no external influences, if the balls were going to hit, it would be mid-way along the x axis.

    The original question stipulates that one cannon is on a hill.
    The other is on the ground. Perhaps your solution works just as well in this case.
    I just had a thought.You guys are all engineering grads!
    (Go and rebuild Iraq and leave us to play in our little sand-pit )
    Just joking.
    regards
    [ November 21, 2003: Message edited by: HS Thomas ]
    Jim Yingst
    Wanderer
    Sheriff

    Joined: Jan 30, 2000
    Posts: 18671
    [DOM]: Assuming no external influences, if the balls were going to hit, it would be mid-way along the x axis.
    [HST]: The original question stipulates that one cannon is on a hill.

    I believe he's including that - later discussion mentions that cannon A is higher than B, and the angle a is apparenly the angle between a direct AB line and the horizontal. DOM's statement above makes sense if we interpret it to mean that the x coordinate of the impact is midway along the axis, but the y coordinate is unspecified. I.e. it's not really on the x-axis.
    Except that for some reason DOM does later seem to be assuming that the impact is exactly on the axis, at the point (x/2, 0), and I have no idea where this assumption comes from. Maybe my interpretation in the previous paragrapoh is incorrect. DOM, consider: if both cannon fire cannonballs at 200 m/s, wouldn't their collision with each other be higher (less vertical drop) than if the velocities had been 100 m/s? Doesn't the vertical coordinate of the impact depend on the velocity? How can we simply assume that the impact point is a (x/2, 0), regardless of initial velocity?
    Also:
    s=ut+1/2*at^2
    0 = v*cos(a) * (d/2v) - 1/2 * g * (d/2v)^2 (gravity is the opposite direction to the intial velocity)

    Is this equation talking about vertical components, or horizontal? v*cos(a) seems to be the horizontal component of the velocity, but g for gravity is talking about vertical, right? I think the terms here are inconsistent.
    The above shows that they don't hit the ground at the same time at the mid point. It does not prove that they cannot hit each other given some other initial velocity.
    Um, I don't think it shows anything really. If you assume that they both hit the ground at (x/2, 0) you might find they do so at different times, but I don't think that initial assumption is justified, and also the subsequent math is suspect.
    [ November 21, 2003: Message edited by: Jim Yingst ]
    Elliot Shanahan
    Greenhorn

    Joined: Sep 30, 2003
    Posts: 2
    If the lower cannon fires its shot in such a way that the shot peaks at the higher cannon(i.e. vertical velocity is 0) the only way the shots would collide is if the higher cannon fired it's shot horrizontally. Any other angle and their respective arcs of fire would never cross.
    HS Thomas
    Ranch Hand

    Joined: May 15, 2002
    Posts: 3404
    Elliot, I imagine timing of the firing of shots and distance between the cannons is relevant in your example. If the top cannonball follows a horizontal course the bottom cannon will have to "pick" it off that course and compensate for gravity and the other factors that Jim mentioned in his previous posts.
    regards
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Cannon fire