Answer
$$
\int_{0}^{4}\ln \left(1+e^{x}\right) dx ,\quad n=8
$$
Here
$$
f(x)=\ln \left(1+e^{x}\right), \quad \Delta x=\frac{4-0}{8}=\frac{1}{2}
$$
(a) the Trapezoidal Rule
$$
\begin{aligned}
T_{8}&=\frac{1}{2 \cdot 2}\{f(0)+2[f(0.5)+f(1)+\cdots+f(3)+f(3.5)]+f(4)\}\\
& \approx 8.814278
\end{aligned}
$$
(b) The midpoints Rule is given by:
$$
\begin{aligned}
M_{8}&=\frac{1}{2}[f(0.25)+f(0.75)+\cdots+f(3.25)+f(3.75)] \\
&\approx 8.799212
\end{aligned}
$$
(c) Simpson’s Rule:
$$
\begin{aligned}
S_{8}&=\frac{1}{2 \cdot 3}[f(0)+4 f(0.5)+2 f(1)+4 f(1.5)+2 f(2)+\\
&\quad\quad +4 f(2.5)+2 f(3)+4 f(3.5)+f(4)] \\
&\approx 8.804229
\end{aligned}
$$
Work Step by Step
$$
\int_{0}^{4}\ln \left(1+e^{x}\right) dx ,\quad n=8
$$
Here
$$
f(x)=\ln \left(1+e^{x}\right), \quad \Delta x=\frac{4-0}{8}=\frac{1}{2}
$$
and so the Trapezoidal Rule can be given by:
$$
\int_{a}^{b} f(x) d x \approx T_{n}=\frac{\Delta x}{2}\left[f\left(x_{0}\right)+2 f\left(x_{1}\right)+2 f\left(x_{2}\right)+\cdots+2 f\left(x_{n-1}\right)+f\left(x_{n}\right)\right]
$$
Therefore,
(a) the Trapezoidal Rule
$$
\begin{aligned}
T_{8}&=\frac{1}{2 \cdot 2}\{f(0)+2[f(0.5)+f(1)+\cdots+f(3)+f(3.5)]+f(4)\}\\
& \approx 8.814278
\end{aligned}
$$
(b) The midpoints Rule is given by:
$$
\int_{a}^{b} f(x) d x \approx M_{n}=\Delta x\left[f\left(\bar{x}_{1}\right)+f\left(\bar{x}_{2}\right)+\cdots+f\left(\bar{x}_{n}\right)\right]
$$
where
$$
\bar{x}_{i}=\frac{1}{2}\left(x_{i-1}+x_{i}\right)=\text { midpoint of }\left[x_{i-1}, x_{i}\right]
$$
So, we have:
$$
\begin{aligned}
M_{8}&=\frac{1}{2}[f(0.25)+f(0.75)+\cdots+f(3.25)+f(3.75)] \\
&\approx 8.799212
\end{aligned}
$$
(c) Simpson’s Rule:
$$
\begin{aligned}
\int_{a}^{b} f(x) d x & \approx S_{n} \\
&=\frac{\Delta x}{3}\left[f\left(x_{0}\right)+4 f\left(x_{1}\right)+2 f\left(x_{2}\right)+4 f\left(x_{3}\right)\\
+\cdots\right. \left.+2 f\left(x_{n-2}\right)+4 f\left(x_{n-1}\right)+f\left(x_{n}\right)\right]
\end{aligned}
$$
So, we obtain:
$$
\begin{aligned}
S_{8}&=\frac{1}{2 \cdot 3}[f(0)+4 f(0.5)+2 f(1)+4 f(1.5)+2 f(2)+\\
&\quad\quad +4 f(2.5)+2 f(3)+4 f(3.5)+f(4)] \\
&\approx 8.804229
\end{aligned}
$$