## Another integral that Mathematica cannot do

The integral to evaluate is

$$\int_0^{\infty} dx \frac{\sin{\left (\pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)}$$

Given the trig functions in the integrand, it makes sense to use the residue theorem based on a complex integral around a rectangular contour. As has been my experience with these integrals, the integrand of the complex integral will not match the integrand of the real integral to be evaluated.

I am asked frequently how I determine the integrand of the complex integral when I am performing a residue theorem evaluation of a real integral. Of course, first one must determine a contour of integration in the complex plane. In general, this can be difficult but for problems involving trig functions or periodic functions in general, a rectangular contour is used. That said, once the contour is determined, if I do not know any better I experiment with the integrand. So perhaps I evaluate the integral around the contour using the integrand of the real integral to be evaluated. In most cases, that will not produce the real integral, but it will provide insight into what the integrand should be.

I encourage the reader to try integrating the original integrand about the rectangular contour described below to see what happens.

Without further ado, consider the complex integral

$$\oint_C dz \frac{\cos{\left (\pi z^2\right )}}{\sinh^3{\left (\pi z\right )}}$$

about the rectangle with vertices $\pm R \pm i$ with small semicircular detours around the poles at $z=\pm i$. The contour integral is then equal to

$$PV \int_{-R}^R dx \frac{\cos{[\pi (x-i)^2]}}{\sinh^3{[\pi (x-i)]}} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\cos{\left [\pi \left (-i+\epsilon e^{i \phi} \right )^2 \right ]}}{\sinh^3{\left [\pi \left (-i+\epsilon e^{i \phi} \right ) \right ]}} \\ + PV \int_R^{-R} dx \frac{\cos{[\pi (x+i)^2]}}{\sinh^3{[\pi (x+i)]}} + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\cos{\left [\pi \left (i+\epsilon e^{i \phi} \right )^2 \right ]}}{\sinh^3{\left [\pi \left (i+\epsilon e^{i \phi} \right ) \right ]}} \\ + i \int_{-1}^1 dy \frac{\cos{\left [\pi \left (R+i y \right )^2 \right ]}}{\sinh^3{\left [\pi \left (R+i y \right ) \right ]}}+i \int_1^{-1} dy \frac{\cos{\left [\pi \left (-R+i y \right )^2 \right ]}}{\sinh^3{\left [\pi \left (-R+i y \right ) \right ]}}$$

Note that the first and third integrals are actually expressed as Cauchy principal values because the individual integrals themselves do not converge. That said, when combined, the resulting integral does converge and we may remove the $PV$ label.

As $R \to \infty$, the last two integrals go to zero.

The second integral approaches, in the limit as $\epsilon \to 0$:

$$i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{-1-2 \pi^2 \epsilon^2 e^{i 2 \phi}+\cdots}{\left (\pi \epsilon e^{i \phi} \right )^3 \left (1 + \frac16 \pi^2 \epsilon^2 e^{i 2 \phi} + \cdots \right )^3} \\ = i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{-1-2 \pi^2 \epsilon^2 e^{i 2 \phi}}{\left (\pi \epsilon e^{i \phi} \right )^3} \left (1-\frac12 \pi^2 \epsilon^2 e^{i 2 \phi} \right ) \to -i \frac32$$

The fourth integral approaches an identical limit as $\epsilon \to 0$.

The first and third integrals combine to produce, as $R \to \infty$,

$$i 4 \int_{-\infty}^{\infty} dx \frac{\sin{\left ( \pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)}$$

The contour integral is also equal to $i 2 \pi$ times the residue of the integrand at $z=0$. The residue may be computed by expanding the integrand in a Laurent series about $z=0$, which is

$$\frac1{(\pi z)^3} \left (1 – \frac12 \pi^2 z^4+\cdots \right ) \left (1 – \frac12 \pi^2 z^2+\cdots \right )$$

The residue is the coefficient of $z^{-1}$, or $-1/(2 \pi)$. Thus,

$$i 4 \int_{-\infty}^{\infty} dx \frac{\sin{\left ( \pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)} – i 3 = -i$$

Rearranging things a bit, we find that the original integral is

$$\int_0^{\infty} dx \frac{\sin{\left ( \pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)} = \frac14$$

### Computing an integral over an absolute value using Cauchy’s theorem

The problem is to compute the following integral: $$\int_{-1}^1 dx \frac{|x-y|^{\alpha}}{(1-x^2)^{(1+\alpha)/2}}$$ I will show how to compute this integral using Cauchy’s theorem. It was remarked that it should not be possible to use Cauchy’s theorem, as Cauchy’s theorem only applies to analytic functions, and an absolute value certainly does not qualify. True. Nevertheless, for the […]

### Integral with two branch cuts II

The problem here is to compute $$\int_0^\infty \log(1+tx)t^{-p-1}dt$$ where $p\in(0,1)$ and $x>0$. This is a great problem for contour integration. Just tricky enough to be really interesting. What makes it interesting is that there are two functions in the integrand needing their own separate branch cuts. One must keep in mind that each function only […]

### Integral with two branch cuts

The problem is to evaluate the following integral: $$\int_{-1}^1 dx \frac{\log{(x+a)}}{(x+b) \sqrt{1-x^2}}$$ where $a \gt 1$ and $|b| \lt 1$. It should be obvious to those who spend time around these integrals that this integral does not converge as stated. However, we only have a simple pole at $x=-b$ so that we can compute […]

### Weird integral whose simplicity is only apparent in the complex plane

Every so often we come across an integral that seems absolutely impossible on its face, but is easily attacked – in fact, is custom designed – for the residue theorem. I wonder why a first year complex analysis class doesn’t show off this case as Exhibit A in why the residue theorem is so useful. […]

### Expansions of $e^x$

A very basic question was asked recently: What is a better approximation to $e^x$, the usual Taylor approximation, or a similar approximation involving $1/e^{-x}$? More precisely, given an integer $m$, which is a better approximation to $e^x$: $$f_1(x) = \sum_{k=0}^m \frac{x^k}{k!}$$ or $$f_2(x) = \frac1{\displaystyle \sum_{k=0}^m \frac{(-1)^k x^k}{k!}}$$ The answer is amazingly simple: […]