Find velocity & angle to fire cannonball through *Two* points

In summary, the function calculates the velocity and angle required to fire a cannonball so that it just passes the top of a wall and hits a castle. The cannon has no limit on its power and the wall that the cannonball must get over is not at the midpoint between the cannon and the castle, it may instead be at any distance between the cannon and the castle (and at any height). The variables are the cannon position, wall height and position, and castle position. The knowns are the cannon's power is unlimited, the cannon's angle is anywhere between 0 and 90 degrees from the horizontal, and gravity. The homework equations are y = v0yt -.5gt^2 and x = v0xt.
  • #1
TimTimTim
4
0
At first this sounds like a very popular and often asked/solved question but it has a twist - I need help with the twist please.

1. Homework Statement

A cannon is at Point A in a 3d environment.

There is a wall at Point B which sits between the cannon and a castle, at Point C.

Write a function that will find the angle and initial velocity required to fire a cannonball so that it just passes the top of the wall and hits the castle. (Meaning it should be in the air for the shortest time possible). I also assume this is easier to work out by considering the top of the wall and the castle as two points the ball must pass through.

The cannon has no limit on it's power - so the initial velocity can be anything.

The twist - The wall that the cannonball must get over is not at the midpoint between the cannon and the castle, it may instead be at any distance between the cannon and the castle (and at any height).

The variables: cannon position, wall height and position, castle position.
The knowns: the cannon's power is unlimited, the cannon's angle is anywhere between 0 and 90 degrees from the horizontal, gravity.

Homework Equations



y = v0yt -.5gt^2

x= v0xt

The Attempt at a Solution



I've solved it for when the wall blocking the cannon and castle is directly in the middle of the parabolic arc. However I don't know what formulas to use or how to work out the required formula for when the wall is not directly in the middle. Just to be clear; if the cannon was at 0,0 and the castle was at 100,0 then the wall could be at any point along the x-axis between 0 and 100... 0<wall<100.
 
Physics news on Phys.org
  • #2
Hello 3Tim, welcome to PF. :)

As you know, a parabola can be drawn through any set of three points. You fix two (cannon and castle) and wall top is point three.
Three equations for three unknowns (a,b,c in ax2+bx+c), so solvable.

Could you post your halfway position/arbitrary height h solution, so we can work from there ?
 
  • #3
Thanks, it's nice to be here!

Hmm, it was a while since I looked at my working solution and I thought I'd solved the initial x and y velocity required for when the wall is in the middle of the arc at a certain height but instead I have solved it for when the wall height is actually unknown and instead the flight time for how long it takes the ball to hit the castle is known. Sorry for getting confused with that.

So here's what I've got for solving it based on the fact that flight time is fixed. (However now that I think about it I don’t think this helps our cause but I’ll post what I’ve done anyway)

x = distance from cannon to castle
y = height difference between cannon and castle (currently using 0 but I would prefer to know how to work it out if this is not 0)
displacement in either x or y can be calculated with --> v0 * t + 1/2 * a * t * t
where a is "-gravity" but only on the y plane, and a is 0 on x plane.
so x = v0x * t => v0x = x / t
and y = v0y * t - 1/2 * gravity * t * t => v0y * t = y + 1/2 * gravity * t * t => v0y = y / t + 1/2 * gravity * t
 
  • #4
Well, that's a bit of a lazy solution, isn't it ? That's not a criticism or an insult (smart physicists are often smart because generally they are so lazy they spend their energy in finding the easiest solutions ;) ).

I always work hard to find the easiest solution -- or beven better: use someone else's, but only if I can follow what it's about).

I liked your attempt to simpify things by placing the cannon at (0,0) and the castle at (100,0) so I'm going to adopt that and combine it with what I proposed in the math area. Easy enough to work it around to a more general situation once we're done.

The description of the trajectory y = ax2+ bx + c, can be rewritten: y = A ( x - x0 ) ( x1 - x ) using the knowledge it has two roots for y = 0 and that it's 'upside down'.

Combine that with the knowledge that it goes through these two points where cannon and castle are located: y = A x ( 100-x )
Only one degree of freedom left over (we used two of the three equations to eliminate x0 and x1)

Third equation can bring in time (which is awkward when written in this 'parametric form'), but we want to bring in the infamous in-between wall.
Since I am explicitly forbidden to hand you the complete solution on a silver plate, I now ask you the easy question:
How do we do that ? :)
 
  • #5
Well I really didn't know where to go with this. By the way I have very little maths knowledge and may well be jumping in at the deep end with this problem. So that being said, I'm not sure if this is what you were thinking of next but I've worked out the following.

y = Ax ( 100-x )

y = 100Ax - Ax^2

Substitute the 0's from the equations

0 = 100Ax - Ax^2

Ax^2 = 100Ax

Ax = 100A

x = 100

I don't think this has helped us though as I think all I've worked out there is one of the points of intersection on the Y.
 
  • #6
Yes, the form came about by putting in x0 andx1, so it's no surprise they come out again when you solve for y = 0. They should both come out ! You swept one under the rug by dividing by x !
Ax^2 = 100Ax

Ax = 100A
First line has two solutions, second line only one !

What we want to do is graze the wall with this sure shot that starts at the cannon and hits the castle.

In your post #1 (attempt at solution) you made a false claim and we are now going to make good on that:

What is A if the wall is halfway and has height h ?
 
  • #7
So I've worked out the following but you may have an easier or simpler way of doing this BvU? Thanks very much for your help so far by the way.

After finding the form of the parabola;
ax^2 + bx + c
I was able to use the following equations to rearrange a, b and c to work out the x and y positions of the vertex (the highest point on the parabola)
vertexX = -b / (2a)
vertexY = c - b^2 / (4a)

Now we know the height of the vertex point. We also know what gravity is. So we can work out the speed required in the y direction in order to reach the vertex height whilst gravity is affecting us.

yVel = Square root of (2g*vertexY)
time = 2*yVel / g
xVel = targetDist / time
Where g is gravity, and targetDist is the target's distance from where the cannon shoots
 
  • #8
Well, I don't see what your steps are to come from ax2 + bx + c to
vertexX = -b / (2a)
vertexY = c - b^2 / (4a)
and then to
yVel = Square root of (2g*vertexY)
time = 2*yVel / g
xVel = targetDist / time
(what are a, b and c in terms of vertexY, g and targetDist ?)
Mind you, the expressions are correct, but I've lost the connection with the description y = A x ( 100-x ) for the trajectory and the value for A if the wall is halfway and has height h.

So how do we now proceed to the general case, where the cannonball has to scale the height h for a given position of the wall xw (with 0 < xw < xtarget) ?
 

Related to Find velocity & angle to fire cannonball through *Two* points

1. How do I find the initial velocity and angle needed to fire a cannonball through two given points?

The initial velocity and angle can be found using the following equations:
- Velocity: v = (d / t) x (1 / cosθ)
- Angle: θ = tan^-1[(g x d) / (2 x v^2)]
where d is the distance between the two points, t is the time taken to travel that distance, and g is the acceleration due to gravity (9.8 m/s^2).

2. What factors affect the velocity and angle needed to fire a cannonball through two points?

The main factors that affect the velocity and angle are the distance between the two points, the time taken to travel that distance, and the acceleration due to gravity. Other factors that may also have an impact include air resistance, wind, and the weight and shape of the cannonball itself.

3. Can I use the same equations for firing a cannonball through two points at different heights?

Yes, the same equations can be used for different heights as long as the distance between the two points remains the same. However, if the distance changes, the velocity and angle needed will also change.

4. How do I take into account air resistance when calculating the velocity and angle for firing a cannonball through two points?

To take into account air resistance, you can use the drag equation: D = 0.5 x ρ x v^2 x Cd x A, where D is the drag force, ρ is the density of air, v is the velocity, Cd is the drag coefficient, and A is the cross-sectional area of the cannonball. This can then be incorporated into the initial velocity equation.

5. Is there a specific angle that will always result in the cannonball hitting both points?

No, there is not a specific angle that will always result in the cannonball hitting both points. The angle needed will depend on various factors such as the distance between the two points, the time taken, and any external factors like air resistance. It is important to calculate the velocity and angle accurately to increase the chances of hitting both points.

Similar threads

  • Introductory Physics Homework Help
Replies
22
Views
3K
  • Introductory Physics Homework Help
Replies
20
Views
2K
  • Introductory Physics Homework Help
Replies
16
Views
3K
  • Introductory Physics Homework Help
Replies
4
Views
21K
  • Introductory Physics Homework Help
Replies
2
Views
4K
  • Introductory Physics Homework Help
Replies
10
Views
6K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
8
Views
2K
Replies
2
Views
13K
Back
Top