Homework 5, Ballistic Trajectory (14 points)

You did such a great job with your ballistic trajectory program, that your former boss is willing to hire you as a consultant to upgrade the work. Then again, maybe you were confused with another ex-employee, but the money is good, so you're taking a shot at it. The real valued function must be named again named "dist", but this time it takes 3 real arguments. The first argument is the angle of inclination of a cannon's barrel from horizontal, in radians. The second argument is the cannon's muzzle velocity in meters per second. The third is the name of an array containing coefficients for a cubic fit to the ground elevation relative to the cannon. The value returned by the function is the range of the cannon shell (in meters) subject to the following assumptions:

  1. Air Fiction is ignored;
  2. Length of the cannon barrel is ignored;
  3. The value of gravitational acceleration g = 9.807 m/s2.
  4. The elevation of the terrain relative to your elevation can be approximated out to 10,000 meters as:
          elevation = c(1)*x + c(2)*x**2 + c(3)*x**3
where x is the distance from the cannon along a flat line at the cannon's elevation, and "c" is the array passed as the third dummy argument.

As one check on your results, your range at 45 degrees should be close to 8303 meters, using the values of "c" in dcannon.f.

Use a Newton iteration to solve for the value of x at which the shell hits the ground. Use your original range calculations for flat ground to generate an initial guess. Use a standard DO loop for the Newton iteration, and use your previous flat terrain distance calculation to provide an initial guess for the iteration. Include an error message, if the Newton method fails to converge within a maximum of 10 iterations.

As before, The function will be audited by the DOD program monitor, and placed in the company software library, so must be generously commented, including a statement of the function's purpose, definitions for all variables, and a line giving your name and the creation date.

I have provided a driver program dcannon.f to test your function. .

This homework will be graded as follows:

See me or check my derivation, if you need help with your basic laws of physics.

Leave your modified version of dcannon.f (don't change the file name) in your "homework" subdirectory. We will pick it up after the due date and test it.

Homework List / Home

Maintained by John Mahaffy : jhm@psu.edu