1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Feb 13, 2015 #1
    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. The problem statement, all variables and given/known data

    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.

    2. Relevant equations

    y = v0yt -.5gt^2

    x= v0xt

    3. 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.
     
  2. jcsd
  3. Feb 13, 2015 #2

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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 ?
     
  4. Feb 13, 2015 #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
     
  5. Feb 14, 2015 #4

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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 ? :)
     
  6. Feb 14, 2015 #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.
     
  7. Feb 14, 2015 #6

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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 !
    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 ?
     
  8. Feb 20, 2015 #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;
    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)
    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.

    Where g is gravity, and targetDist is the target's distance from where the cannon shoots
     
  9. Feb 22, 2015 #8

    BvU

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Well, I don't see what your steps are to come from ax2 + bx + c to
    and then to
    (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) ?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted