Defining the Trapezoid/Midpoint rules

We can define the Trapezoid rule as follows:

trapRule[n_] := {Δx = (b - a)/n ; N[Δx/2 (f[a] + Underoverscript[∑, k = 1, arg3] (2f[a + k Δx]) + f[b]), 20]}

Define a similar function for the midpoint rule, calling it midPointRule[n].

Use a table to show the values of the Trapezoid and Midpoint rules for at least one order of magnitude of n (i.e., 100 to 1000, for example).  


Created by Mathematica  (April 22, 2004)