\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}

{\bf{Hint:}} In this question make sure you use radians for input
to trigonometric functions.

Calculate to 4 decimal places of accuracy,

$$J=\ds\int_0^1 \ds\frac{e^{x}\sin x}{1+x^2} \,dx,$$

by using,

\begin{description}
\item[(i)]
the trapezium rule with 5 ordinates;

\item[(ii)]
Simpson's rule with 5 ordinates.

\item[(iii)]
Compare your answers with the exact result $J=0.608087...$,
calculating the percentage error in each case.

\end{description}

\medskip

{\bf Answer}
\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)$

5 ordinates $\Rightarrow$ 4 strips

Width of strips=$\ds\frac{1-0}{4}=0.25$

\begin{tabular} {c|c|c|c|c|c|}
$x$ & 0.00 & 0.25 & 0.5 & 1.75 & 1.00\\

\hline

$y$ & 0 & 0.29899 & 0.63235 & 0.92354 & 1.14368

\end{tabular}

\begin{eqnarray*} I & = &
\ds\frac{0.25}{2}((0+1.14368)\\ & & +2\times(0.29899+0.63235 +
0.92354))\\ & = & 0.125(1.14368+3.70976)\\ & = & 0.125 \times
4.85344\\ & = & 0.60668...\\ & = & 0.6067...
\end{eqnarray*}

\item[(ii)]
Simpson with 5 ordinates

$I \approx \ds\frac{h}{3}(y_1+4y_2+2y_3+4y_4+y_5)$

Ordinates $y_i$ are the same as above (h too).

Hence

\begin{eqnarray*} I & \approx &
\ds\frac{0.25}{2}((0+1.14368)+4\times(0.29899+0.92354)\\ & &
+2\times0.63235)\\ & \approx &
\ds\frac{0.25}{3}(1.14368+4.89012+1.26470)\\ & = &
\ds\frac{0.25}{3}[7.29850]\\ & = & 0.6082 \end{eqnarray*}

\item[(iii)]
Trap is accurate to $\left|\ds\frac{(0.608087-0.6066)}{0.608087}
\times 100\right|=0.24 \% $

Simpson is accurate to
$\left|\ds\frac{(0.608087-0.60821)}{0.608087} \times
100\right|=0.02 \% $

Simpson is 10 times better!!
\end{description}
\end{document}
