# Cannon Impact on Non-Flat Terrain

If you are having problems figuring out what equation to solve take a look at the following.

First I want to know the path the shell will follow through space. It's like putting a bright light on the shell, and photographing the entire flight with the camera's shutter stuck open. When I develop the film, I see a portion of a parabola that begins at the cannon and ends where the shell hits the ground.

I start with the basic laws of motion in the x and y direction.

x = v0* cos(angrad) * t                               (1)
y = v0 * sin(angrad) * t  -  0.5 * g * t**2           (2)
v0 is 300 meters per second (about sound speed).

I solve Equation (1) for t and get:

t = x / (v0*cos(angrad))
Now I substitute this into Equation (2) and get:

y(x) =  x*tan(angrad) - (0.5*g*x**2)/(v0*cos(angrad))**2
This is the equation for the light streak in our picture.

I'll need the derivative of this function later for Newton's method.

dy                             g*x
--   =   tan(angrad) -  -------------------
dx                      (v0*cos(angrad))**2

Notice that I only need the derivative with respect to x. For any given solution "angrad" is treated as a known constant.

Now I have the trajectory of the shell. Next I have to find the point where the shell's trajectory intersects the ground. Mathematically that can be written as:

y(x)=h(x)

or rearranging:

y(x)-h(x)=0

Now if I define a new function f(x) to be:

f(x)= y(x)-h(x)

then I'm back to solving the problem f(x)=0, that we discussed in class, I've worked this out for you in newton1.f & newton2.f.

You want to solve f(x) = y(x) - h(x) = 0

You have y(x) above, and a specific expression for h(x)

All you need is the derivative of f(x)

df        dy       dh
--   =    --   -   --
dx        dx       dx

Plug the new formulae for f(x) and dfdx into the right spots of my examples and you should be home free.