# Approximation of integral

We consider the integral $$\int_0^1\frac{1}{x+3}\, dx$$

Using the trapezoid formula with $$h=0.25$$ we get the following:

The formula is $$T(h)=h\cdot \left (\frac{f(a)}{2}+\sum_{i=1}^{n-1}f(a+ih)+\frac{f(b)}{2}\right )$$

In this case we get \begin{align*}T(0.25)&=0.25\cdot \left (\frac{f(-1)}{2}+f(-0.75)+f(-0.5)+f(-0.25)+f(0)+f(0.25)+f(0.5)+f(0.75)+\frac{f(1)}{2}\right )\\ & \approx 0.2879349167\end{align*}

The exact value of the integral is $$\log\left (\frac{4}{3}\right )\approx 0.287682072$$. So the difference of the approximation and the real value of the integral is approximately $$-0.0002528442$$.

An upper bound for the error is $$\frac{h^2}{12}(b-a)\|f''\|_{\infty}=\frac{0.25^2}{12}\cdot 1\cdot \frac{1}{27}=\frac{1}{5184}\approx 0.000193$$ or not?

My error is bigger than that. Is the formula that I used wrong?

• What are the limit values in the integral? And in the sum? – user376343 Feb 6 at 17:23

You get $$f'(x)=-\frac{1}{(x+3)^2}$$ and $$f''(x)=\frac{2}{(3+x)^3}$$ so that the bound is missing a factor of 2, and twice your result is larger than the actual error.