Homework

Your examples directory should contain a program called ``integrate.c'', which contains an implementation of the trapezoidal method. You can also view the program directly. In this assignment, you will be modifying this program.

  1. Add a function rectangle to integrate.c that takes the same parameters as trapezoid but computes a rectangular approximation. Modify main to print out the results of both approximations for a given value of N.
  2. Use Maple's int function to determine Maple's approximation to the integral of the integrand used in integrate.c. Prepare a table showing the differences between the two approximations in your C program with Maple's approximation as N takes on values of 5, 10, 20, 40, 80, and 160. What conclusions about the two approximation techniques can you draw from this table?


Christopher R. Johnson
Hamlet Project
Department of Computer Science
University of Utah