Calculate integral from 0 to 1 dx/(1+x) by dividing [0,1]
Calculate $\displaystyle\int_0^1\frac{dx}{1+x}$ by dividing $[0,1]$ into 8 subintervals using (a) the rectangle (midpoint) formula, (b) the trapezoidal formula, (c) Simpson's formula, and compare each with the exact value.
Explanation of Method
With the same 8-subinterval partition ($h=0.125$) used throughout, apply each rule's characteristic weighted sum to $f(x)=1/(1+x)$, and compare all three results against the exact value $\ln2$ to see how the error shrinks as the method's order of accuracy increases.
Step 0: Exact value
\[I_{\text{exact}}=\int_0^1\frac{dx}{1+x}=\big[\ln(1+x)\big]_0^1=\ln2\approx0.693147181.\]
Step 1(a): Rectangle (midpoint) method, $n=8$
With $h=0.125$ and midpoints $x_i^*=(i-\tfrac12)h$:
| $x_i^*$ | 0.0625 | 0.1875 | 0.3125 | 0.4375 | 0.5625 | 0.6875 | 0.8125 | 0.9375 |
| $f(x_i^*)$ | 0.941176 | 0.842105 | 0.761905 | 0.695652 | 0.640000 | 0.592593 | 0.551724 | 0.516129 |
Sum $=5.541284$, so $I_{\text{rect}}=0.125\times5.541284\approx0.692661$.
\[\boxed{I_{\text{rect}}\approx0.692661},\qquad E_{\text{rect}}\approx4.87\times10^{-4}\]
Step 1(b): Trapezoidal method, $n=8$
With nodes $x_i=0.125i$, $i=0,\dots,8$, weighted $1,2,2,\dots,2,1$: weighted sum $=11.105950$, so
\[I_{\text{trap}}=\frac{0.125}{2}\times11.105950\approx0.694122.\]
\[\boxed{I_{\text{trap}}\approx0.694122},\qquad E_{\text{trap}}\approx9.75\times10^{-4}\]
Step 1(c): Simpson's method, $n=8$ ($2n=8$ intervals)
Same nodes, weights $1,4,2,4,2,4,2,4,1$: weighted sum $=16.635709$, so
\[I_{\text{Simpson}}=\frac{0.125}{3}\times16.635709\approx0.693155.\]
\[\boxed{I_{\text{Simpson}}\approx0.693155},\qquad E_{\text{Simpson}}\approx7.35\times10^{-6}\]
Step 2: Comparison
Simpson's rule is roughly $66\times$ more accurate than the midpoint rule and about $133\times$ more accurate than the trapezoidal rule here — consistent with its $O(h^4)$ error order versus $O(h^2)$ for the other two, and with Simpson's rule being exact for cubics while the others are exact only for linear functions.
Result
Final answer:
\[\boxed{I_{\text{exact}}=\ln2\approx0.693147,\quad I_{\text{rect}}\approx0.692661,\quad I_{\text{trap}}\approx0.694122,\quad I_{\text{Simpson}}\approx0.693155}\]