ABSTRACT

The data set used to illustrate subroutine trap is taken from Example 6.2. The output generated by the trapezoid rule program is presented in Output 6.1.

Output 6.1 Solution by the trapezoid rule

6.8.2. Simpson's 1/3 Rule The general algorithm for Simpson's 1/3 rule is given by Eq. (6.35):

I = ~h(fo + 4fi + 212 + 4.13 + ... + 4/,',-1 +In) (6.115) A FORTRAN subroutine, subroutine simpson, for implementing Simpson's 1/3 rule

is presented in Program 6.2. Subroutine simpson works essentially like subroutine trap discussed in Section 6.8.1, except Simpson's 1/3 rule is used instead of the trapezoid rule. Program main defines the data set and prints it, calls subroutine simpson to implement Simpson's 1/3 rule, and prints the solution. Only the statements in program main which are different from program main in Section 6.8.1 are presented.