# Homework 14, Secant Method (14 points)

This is a rerun of Homework 8, but this time you must solve the problem with a Secant iteration. The real valued function giving the horizontal distance traveled by the shell must be named again named "dist", and take 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 Secant iteration to solve for the value of x at which the shell hits the ground. Use a standard DO loop for the Secant iteration, and use your previous flat terrain distance calculation to provide an initial guess for the iteration. Include an error message, if the iteration method fails to converge within a maximum of 10 iterations.

I have provided an old Newton solution scannon.f as a starting point.

This homework will be graded as follows:

• 2 points for quality of comments
• 2 points for demonstrating that you can use a DO loop.
• 7 points for proper form of the Secant iteration.
• 2 points for correct output values
• 1 point for the print statement on convergence failure
See me or check my derivation, if you need help with your basic laws of physics.

Leave your modified version of scannon.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