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.

  • $\begingroup$ Hard to guess what $p$ is without an explicit definition. Morover, how the trapezoid method is carried out, since we have an integral over an unbounded domain? $\endgroup$ – Jack D'Aurizio Aug 27 '15 at 14:07
  • $\begingroup$ I edited the question, also since the integrand converges very quickly, I just used an upper-limit of 100. $\endgroup$ – dable Aug 27 '15 at 14:21
  • $\begingroup$ in your question, now $p$ is defined in terms of $I_n$, but $I_n$ is still undefined (however, this time is not difficult to guess what it is). $\endgroup$ – Jack D'Aurizio Aug 27 '15 at 14:49
  • $\begingroup$ Fixed again! Thanks for pointing it out :) $\endgroup$ – dable Aug 27 '15 at 15:07
  • $\begingroup$ What are your values for $I_n$? Also, have you tried computing to different precisions (you should be using at least double, if not more)? $\endgroup$ – marty cohen Aug 27 '15 at 15:34

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.


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 $.

  • $\begingroup$ What the location of the stationary points has to do with the order of convergence of the trapezoid method? $\endgroup$ – Jack D'Aurizio Aug 27 '15 at 15:46
  • $\begingroup$ I don't know. As I said, those are random babblings. $\endgroup$ – marty cohen Aug 28 '15 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.