Why is the estimate of the order of error in Trapezoid converging to $2.5$? The integral in question is:
$\int_{0}^{\infty} \frac{x^{3/2}}{\cosh{(x)}}dx$
I coded a program to compute $p$, an estimate of the order of the error for the Trapezoid method of numerical integration. From class, I know that the order of the error for this method is $2$ as it goes like $h^2$ where $h$ is the step size (this is for the composite Trapeziod rule).
However when I run my program the the values for the estimate of $p$ seem to converge to $2.5$. I asked my lecturer and she said this is write, but I do not understand why?
I know that the error depends on the 2nd derivative of the integrand,and the function I am dealing with is not bounded on the interval of integration, but I do not get why that results in the convergence of the estimate to 2.5?
$p = \frac{\ln{r}}{\ln{2}}, r = \frac{I_n - I_{2n}}{I_{2n}-I_{4n}}$
Where $I_n$ represents the approximate value of the integral for $n$ sub-intervals.
 A: The error of the trapezoid method is given in terms of the second derivative of a function. 
Our function is smooth and fast-decaying outside any right neighbourhood of the origin, but in a right neighbourhood of the origin the second derivative of $f$ is unbounded and behaves like $\frac{1}{x^{1/2}}$.
That is the reason for which $p\to 2+\frac{1}{2}$. You may also notice that you may "smoothen" the function by computing the equivalent integral:
$$ I = \int_{0}^{+\infty}\frac{x^4}{\cosh(x^2)}\,dx. $$
Try to see what happens by applying the trapezoid method to that function, instead of the original one. That gives a function with a bounded second derivative.
A: Some random babblings:
Let $f(x)
=\frac{x^{3/2}}{\cosh(x)}
$.
For large $x$,
$f(x)$ is essentially zero,
so you might be losing
many significant digits
in subtraction,
especially if
$I_{2n}$ is quite close to
$I_n$.
Also,
at the origin,
$f(x)
\approx x^{3/2}
$,
so there is no problem there.
$f'(x)
=\frac{(3/2)x^{1/2}\cosh(x)-x^{3/2}\sinh(h)}{\cosh^2(x)}
$,
so $f'(x) = 0$
when
$0
=(3/2)x^{1/2}\cosh(x)-x^{3/2}\sinh(x)
=x^{1/2}\cosh(x)\left((3/2)-x\tanh(x)\right)
$
or,
according to Wolfy,
$x\approx 1.62182
$.
