Homework 15

Solution of an ODE (17 points)

For our final problem we will return to a different look at the cannon problem. You have accidentally fired the cannon while it is pointed straight up in the air. How much time do you have before the shell comes crashing back down on the cannon? I'm looking for a more accurate answer here than we obtained in the past, including effects of air resistance.

Take a look here for a description of the equations that must be solved. The basic framework already exists in the file lastshot.f. You must look at the existing data structure and argument list to the subroutine odesolve. Fill in odesolve, so that it functions within the existing program. Points will be lost for redefining constants that have already been set, or reinitializing elements of the array that have already been set to initial conditions. You may not alter the "call odesolve" statment.

Subroutine odesolve must advance the solution of the motion equations from the initial conditions to the point in time where the value of the height (z) first becomes negative. It must use a Crank-Nicholson method (Trapezoidal Rule) to obtain the results at each time step. In the process, values of time (t), height (z), and velocity (v) are stored for each time step. The name of the variable "nsteps" is a little deceptive. Look at how it is used to determine how you set it in odesolve.

Grading will be as follows:

Comments (including description of equations solved) - 3 points

Correct form of the difference equations - 6 points

Correct use of the existing data structure - 6 points

Correct solution - 2 points

Homework List / Home

Maintained by John Mahaffy : jhm@psu.edu