Numerical integration: Most numerical methods for evaluating a definite integral $\int_a^b f(x) d x$ are based on interpolation. One chooses $n+1$ interpolation points $a \leq x_0<$ $x_1<\cdots<x_n \leq b$ and replaces the integrand by its interpolating polynomial $p_n(x)$ of degree $n$, leading to the approximation $\int_a^b f(x) d x \approx \int_a^b p_n(x) d x$, where the polynomial integral can be done explicitly. Write down the following popular integration rules:
(a) Trapezoid Rule: $x_0=a, x_1=b$. (b) Simpson's Rule: $x_0=a, x_1=\frac{1}{2}(a+b), x_2=b$.
(c) Simpson's $\frac{3}{8}$ Rule: $x_0=a, x_1=\frac{1}{3}(a+b), x_2=\frac{2}{3}(a+b), x_3=b$.
(d) Midpoint Rule: $x_0=\frac{1}{2}(a+b)$. (e) Open Rule: $x_0=\frac{1}{3}(a+b), x_1=\frac{2}{3}(a+b)$.
(f) Test your methods for accuracy on the following integrals:
(i) $\int_0^1 e^x d x$
(ii) $\int_0^\pi \sin x d x$,
(iii) $\int_1^e \log x d x$
(iv) $\int_0^{\pi / 2} \sqrt{x^3+1} d x$.
Note: For more details on numerical differentiation and integration, you are encouraged to consult a basic numerical analysis text, e.g., [8].