Implementation of Midpoint, Trapezoidal, and Simpson Rule
Implementation of the following methods to compute the integral numerically--
(a) Midpoint rule
(b) Trapezoidal rule
(c) Simpson’s rule
for NI intervals. Since Simpson’s rule requires an even number of intervals, assume NI even.
Note that the number of points is N = NI for open rules and N = NI + 1 for closed rules.
Generation of a single plot showing the absolute error versus NI for the different methods with a = 5,
b = 10, and c = 4.