# Composite trapezoidal rule and Simpson rule question?

We have the following integral $$\int_{1}^{3} \frac x{x^2+4}\; dx$$ and $n=6$. I have to approximate it using composite trapezoidal rule and then composite simpson rule.

Using trapezoidal rule:

$$\int_a^b f(x)\; dx = \frac h2 \left[f(a)+2\sum_{j=1}^{n-1}f(x_j)+f(b)\right]-\frac{b-a}{12}h^2f''(\mu)$$

where $h=\frac{3-1}6=1/3$.

Here is my solution for composite trapezoidal rule and error formula:

$$h=\frac{b-a}n=\frac{3-1}6=\frac13 \\ \int_a^bf(x)\;dx = \frac h2 \left[f(a)+2\sum_{j=1}^{n-1}f(x_1)+f(b)\right]$$

$$\begin{array}{c|l} x & y \\ \hline 1 & 0.2 \\ \frac43 & 0.2343 \\ \frac53 & 0.2466 \\ 2 & 0.25 \\ \frac73 & 0.2470 \\ \frac83 & 0.2400 \\ 3 & 0.2307 \end{array}$$

\begin{align} \int_1^3\frac x{x^2+4}\;dx & = \frac16[0.2+0.2307+2(0.2343+0.2466+0.25+0.2470+0.24)] \\ & = 0.48065 \end{align}

We see that $n=2$.

\begin{align} E & =-\frac{b-a}{12}\cdot h^2f''(n) \\ & =-\frac2{12}\cdot\left(\frac13\right)^2\cdot\frac{2n\left(n^2-12\right)}{\left(n^2+n\right)^3} \end{align}

Here $n=2$.

• To approximate the integral, you usually don't have to write down the error term. On the other hand you haven't used that $n = 6$. So, this is not correct. – Hans Engler Feb 11 '15 at 22:08
• Composite it is. – user3543012 Feb 12 '15 at 10:10
• @Amzoti I solved this for the composite trapezoidal rule and I also found the error.Is this correct? i.imgur.com/OsmPVS5.jpg – user3543012 Feb 12 '15 at 12:08
• Thank you.Beside that,does it look alright? – user3543012 Feb 12 '15 at 13:57
• I checked it,it is correct. – user3543012 Feb 12 '15 at 13:58