Implementing the Trapezoidal Method

Now let's come up a C implementation for the trapezoidal method, using the formula


as our basis. Suppose that we want to implement a function trapezoid that will numerically integrate a function integrand that is defined elsewhere in the program. What should the prototype for trapezoid look like?

Click here for the answer

The summation that we've come up with suggests a while loop. What should the while loop do?

Click here for the answer

Try to come up with an implementation of trapezoid before looking at our solution.

Click here for an answer

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