# Integral evaluation - analytical vs. numerical

• broegger
In summary, the conversation discusses the reason why the integral \int_{-\infty}^{\infty}\cosh(x)^{-n}dx (n>0) can be evaluated analytically when n = 1,2,3,..., but only numerically when n is non-integer. The conversation suggests that this is due to the use of the residue theorem in complex analysis for integer values of n, while for non-integer values, other numerical methods must be used. It is also mentioned that this result is related to the gamma function, which can be expressed in terms of elementary functions for whole and half integers but requires other forms of numerical calculation for arbitrary values. Overall, whether an integral has an analytical solution
broegger
Hi,

Does anyone know a reason why $$\int_{-\infty}^{\infty}\cosh(x)^{-n}dx$$ (n>0) can be evaluated analytically when n = 1,2,3,..., but only numerically when n is non-integer. I don't know if there is a "reason", but I'm using this result in a Quantum Mechanics project and it would be cool if I could give some kind of intuitive reason why this is so.

My best guess:
You may use the residue theorem from complex analysis to gain an exact expression in the case of integer values, whereas this won't work if you have a non-integer.
I might be wrong, though..

I've attached the antiderivative and here's your integral

$$\int_{-\infty}^{+\infty} \frac{dx}{\cosh^{n} x}=\frac{\sqrt{\pi}}{2}\frac{\Gamma \left(\frac{n}{2}\right)}{\Gamma \left(\frac{n+1}{2}\right)}$$

"n" can be complex,even.

Daniel.

EDIT:The correct result is multiplied by 2.See posts #4 & #7.

#### Attachments

• Integrate.gif
1.6 KB · Views: 537
Last edited:
O.K, in Mathematica I go that if $\Re (n) > 0$ then:

$$\int_{-\infty}^{+\infty} \cosh^{-n} (x) dx = \frac{ \sqrt{\pi} \, \Gamma\left( \frac{n}{2} \right)}{ \Gamma\left( \frac{n + 1}{2} \right)}$$

How do you explain the "1/2" factor discrepancy...?

Daniel.

EDIT:See post #7 for details.

Last edited:
dextercioby said:
How do you explain the "1/2" factor discrepancy...?

Danie.
Well if I left n=1 and integrate in mathematica I get $\pi$ and:

$$\Gamma \left( \frac{1}{2} \right) = \sqrt{\pi}$$

Are you sure you did not integrate between 0 and Infinity?

Last edited:
I got it,i plugged only for half a domain

Using [1]

$$\int_{0}^{+\infty} \frac{\sinh^{\mu}x}{\cosh^{\nu}x} \ dx =\frac{1}{2}B\left(\frac{\mu +1}{2},\frac{\nu-\mu}{2}\right)$$ (1)

,provided that

$$\mbox{Re} \left(\mu\right) >-1 \ ; \ \mbox{Re} \left(\mu-\nu\right) <0$$ (2)

Making $\mu=0$ (3) in (1) (admissible according to (2) and implying the condition $\mbox{Re} (\nu) >0$ (4) ),one gets

$$\int_{0}^{\infty} \frac{dx}{\cosh^{\nu} x} \ dx =\frac{1}{2} B\left(\frac{1}{2},\frac{\nu}{2}\right)=\frac{1}{2}\frac{\Gamma \left(\frac{1}{2}\right)\Gamma \left(\frac{\nu}{2}\right)}{\Gamma\left(\frac{\nu+1}{2}\right)}$$ (5)

Using

$$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}$$ (6)

and

$$\int_{\mathbb{R}} \frac{dx}{\cosh^{\nu} x} \ dx =2 \int_{0}^{\infty} \frac{dx}{\cosh^{\nu} x} \ dx$$ (7)

,one gets exactly the formula posted by Zurtex.

Daniel.

--------------------------------------------------
[1]G & R,5-th edition,Academic Press,CD version,1996,page 388,formula 3.512-2.

Zurtex said:
Well if I left n=1 and integrate in mathematica I get $\pi$ and:

$$\Gamma \left( \frac{1}{2} \right) = \sqrt{\pi}$$

Are you sure you did not integrate between 0 and Infinity?

Yes,i used an online integrator and indeed integrated only half of the domain.

I'll edit and make a reference to your post & mine just above.

Daniel.

So just in case anyone is at all unclear about how this relates to the original observation that :
Does anyone know a reason why $$\int_{-\infty}^{\infty}\cosh(x)^{-n}dx$$ (n>0) can be evaluated analytically when n = 1,2,3,..., but only numerically when n is non-integer.

It's because $$\Gamma(x)$$ is easily expressable in terms of elementary functions and constants for whole and half integers but generally needs other forms of numerical calulation for arbitrary values of "x".

Last edited:
Incidentally,both beta & gamma-Euler are tabulated for a certain range of values of their arguments.

So the integral is solvable analytically.Expressing its values in terms of analytical special functions means just that.

Daniel.

dextercioby said:
So the integral is solvable analytically.Expressing its values in terms of analytical special functions means just that.
That means that whether an integral has an analytical solution or not is based on convention (how many special functions are named). I don't find such a distinction very useful. I would echo uart's comment.

Thanks y'all. I've included a bit about the gamma function, interesting stuff...

## 1. What is the difference between analytical and numerical evaluation of integrals?

Analytical evaluation of integrals involves finding the exact solution using mathematical formulas and techniques, while numerical evaluation uses approximation methods to estimate the solution.

## 2. Which method is more accurate - analytical or numerical evaluation?

Analytical evaluation is generally more accurate since it provides the exact solution, while numerical evaluation can introduce errors due to the use of approximation methods.

## 3. When should I use analytical evaluation and when should I use numerical evaluation?

Analytical evaluation is typically used for simple integrals with known formulas, while numerical evaluation is more suitable for complex integrals or when an exact solution is not needed.

## 4. What are some common numerical methods used for evaluating integrals?

Some common numerical methods for evaluating integrals include the trapezoidal rule, Simpson's rule, and the Monte Carlo method.

## 5. Are there any advantages of using numerical evaluation over analytical evaluation?

While analytical evaluation provides the exact solution, numerical evaluation can be more efficient for complex integrals since it can be automated and can handle a wide range of functions.

• General Math
Replies
4
Views
1K
• General Math
Replies
4
Views
390
• Quantum Physics
Replies
1
Views
574
• Calculus
Replies
1
Views
910
• General Math
Replies
1
Views
1K
• Calculus
Replies
16
Views
2K
• General Math
Replies
1
Views
2K
• Calculus and Beyond Homework Help
Replies
2
Views
1K
• General Math
Replies
3
Views
978