\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}

Let

$$J=\ds\int_0^1 \ds\frac{\sin x}{1+x^3} \,dx,$$

where the integral limits are in \un{radians}.

Carefully explaining your method, calculate $J$ to 4 decimal
places using

\begin{description}
\item[(i)]
the trapezium rule with 5 ordinates,

\item[(ii)]
Simpson's rule with 5 ordinates.

\end{description}

Compare your answers with the exact result $J=0.346997...$

{\bf{Note:}} Marks will only be awarded if sufficient working is
shown.

\medskip

{\bf Answer}

$$J=\ds\int_0^1\ds\frac{\sin x}{1+x^3} \,dx$$

\begin{description}
\item[(i)]
Trapezium rule with 5 ordinates:

$J \approx \ds\frac{d}{2}(y_1+2y_2+2y_3+2y_4+y_5)$

where $d=\ds\frac{1-0}{5-1}=\ds\frac{1}{4}$

$\begin{array} {ll} x_1=0 & x_4=\ds\frac{3}{4}\\
x_2=\ds\frac{1}{4} & x_5=1\\ x_3=\ds\frac{1}{2}
\end{array}$

$$y_i=f(x_i);\ \ f(x)=\ds\frac{\sin x}{(1+x^3)}$$

\begin{tabular} {c|c|c|c|c|c|}
$x$ & 0 & $\frac{1}{4}$ & $\frac{1}{2}$ & $\frac{3}{4}$ & 1\\

\hline

$y$ & 0 & 0.243598 & 0.426156 & 0.479394 & 0.420735

\end{tabular}

\begin{eqnarray*} J & \approx &
\ds\frac{1}{8}(0.420735+2\times(0.479394+0.426156 + 0.243598)+0)\\
& = & \un{0.339879} \end{eqnarray*}

\newpage
NB working

\begin{eqnarray*} & = & \ds\frac{1}{8} \times (0.420735+2.2983)\\ &
= & \ds\frac{1}{8} \times 2.71903\\ & = & 0.339879 \end{eqnarray*}



\item[(ii)]
Simpson with 5 ordinates

$J \approx \ds\frac{h}{3}(y_1+4y_2+2y_3+4y_4+y_5)$

4 equal segments $\Rightarrow h=\ds\frac{1}{4}$ as above

and we have the \un{same} $y_i$s as above.

Hence

\begin{eqnarray*} J & \approx &
\ds\frac{1}{12}\times(0+4\times(0.243598+0.479394)\\ & & +2\times
(0.426156)+0.420735)\\ & = & 0.347085\\ & = & \un{0.4407}
\end{eqnarray*}

NB working

\begin{eqnarray*} & & \ds\frac{1}{12} \times(2.89197+0.852312 +
0.420735)\\ & = & \ds\frac{1}{12} \times 4.16502\\ & = & 0.347085
\end{eqnarray*}

Actual=0.346997 to get 6dp

$\Rightarrow$ Trapezium is accurate to $2\%$ or 1dp and Simpson is
accurate to $0.02\%$ or 3dp.

\end{description}

\end{document}
