# Evaluating the integral $\int_0^1 \frac{\cos bx}{\sqrt{x^2+s^2} }dx$

I'd really love to evaluate this integral exactly in terms of known functions, because for large $$b$$ it becomes a pain numerically.

$$I(b,s)=\int_0^1 \frac{\cos bx}{\sqrt{x^2+s^2} }dx$$

Didn't get anywhere wth integration by parts, or series. I want an expression valid for both large and small values of the parameters.

Note: we have $$b= \pi n$$, where $$n$$ is an integer.

For $$s \gg 1$$ we can expand the root as a series and get a good approximation. However, this case is of small use to me, as in general $$s$$ is of the order of $$1$$ or smaller.

So here's my latest attempt:

Edited

$$x=s \sinh v$$

$$I(b,s)=\int_0^{\sinh^{-1} \frac{1}{s}} \cos \left(bs \sinh v \right) dv$$

Let's try integration by parts:

$$U=\cos \left(bs \sinh v \right) \\ dV=dv$$

$$dU=-bs\sin \left(bs \sinh v \right) \cosh v \\ V=v$$

$$I(b,s)=\cos b \sinh^{-1} \frac{1}{s}+bs \int_0^{\sinh^{-1} \frac{1}{s}} v \sin \left(bs \sinh v \right) \cosh v dv$$

$$I(b,s)=\cos b \sinh^{-1} \frac{1}{s}+bs \int_0^{\frac{1}{s}} \sinh^{-1} r \sin \left(bs r \right) dr$$

$$I(b,s)=\cos b \sinh^{-1} \frac{1}{s}+b \int_0^1 \sinh^{-1} \frac{x}{s} \sin \left(b x \right) dx$$

This seems a little better, at least we separated the special case $$I(0,s)$$, which is the first term. Not sure how to continue.

Using the fact that $$b= \pi n$$, we can transform the integral as:

$$b \int_0^1 \sinh^{-1} \frac{x}{s} \sin \left(b x \right) dx=\pi \sum_{k=0}^{n-1} (-1)^k \int_0^1 \sinh^{-1} \left( \frac{t+k}{ns} \right) \sin \pi t dt$$

The function $$\sinh^{-1}$$ is pretty nice, it has a logarithmic growth, and doesn't blow up anywhere. I guess, this could be the way to get a good approximation, especially since we have an alternating sum.

• Have you tried by using Contour Integration, Residue theorem etc. on the function $\displaystyle \frac{e^{ibz}}{\sqrt{z^2+s^2}}$ around the contour $|z|=1$ – Sujit Bhattacharyya Nov 15 '18 at 12:32
• @SujitBhattacharyya, I'm bad at contour integration, especially with roots, aren't there branch cuts to deal with? If you could show me how to do that... – Yuriy S Nov 15 '18 at 12:33
• If you just need an approximation why don't you use the trapezoidal rule or some other such method? WolframAlpha didn't seem to find any expansion in terms of standard mathematical functions. – Sorin Tirc Nov 15 '18 at 12:51
• @SorinTirc, approximation is the last option I'd consider, and trapezoidal rule is horrible for large $b$ (the function oscillates like crazy). I've used numerical methods on this, and they are slow and inaccurate, even with the best Mathematica has to offer. Moreover, see my edit. I think I'm on the right path with the exact evaluation... – Yuriy S Nov 15 '18 at 12:53
• In Mathematica 11.3 we can use command: AsymptoticIntegrate[Cos[b x]/Sqrt[ x^2 + s^2], {x, 0, 1}, {b, Infinity, 2}, Assumptions -> s > 0] and we get:$\frac{\sin (b)}{b \sqrt{s^2+1}}-\frac{\cos (b)}{b^2 \left(s^2+1\right)^{3/2}}$ for b->Infinity – Mariusz Iwaniuk Nov 15 '18 at 17:01

Getting a grasp of the original problem: we want to find the asymptotic behaviour of the Fourier coefficients of $$\frac{1}{\sqrt{x^2+s^2}}\in L^2(0,1)$$. Since the inverse Laplace transform of $$\frac{1}{\sqrt{x^2+s^2}}$$ is $$J_0(as)$$ and the Laplace transform of $$\cos(\pi n x)\mathbb{1}_{(0,1)}(x)$$ is $$\frac{a}{a^2+n^2\pi^2}-\frac{a(-1)^n}{e^a(a^2+\pi^2 n^2)}$$, we have

$$\int_{0}^{1}\frac{\cos(\pi n x)}{\sqrt{x^2+s^2}}\,dx = \underbrace{\int_{0}^{+\infty}\frac{a J_0(as)}{a^2+\pi^2 n^2}\,da}_{K_0(\pi n s)} + (-1)^{n+1}\int_{0}^{+\infty}\frac{a J_0(as)}{e^a(a^2+\pi^2 n^2)}\,da$$ which is fairly easy to approximate numerically due to the known bounds for Bessel functions.
Close to the origin $$J_0(a)$$ can be approximated through its rapidly-convergent Maclaurin series, far from the origin we have Tricomi's $$J_0(a)\approx\frac{\sin(a)+\cos(a)}{\sqrt{\pi a}}$$. For $$K_0$$ we have Hankel's expansion.

In particular the Fourier coefficients of $$\frac{1}{\sqrt{x^2+s^2}}$$ decay like $$\frac{1}{n^2 s^3}$$.

It is also interesting to point out a curious inequality provided by Cauchy-Schwarz:

$$\begin{eqnarray*}\left|\int_{0}^{+\infty}\frac{a J_0(as)}{e^a(a^2+\pi^2 n^2)}\,da\right|^2&\leq& \int_{0}^{+\infty}\frac{J_0(as)^2}{e^{2a}}\,da\int_{0}^{+\infty}\frac{a^2}{(a^2+\pi^2 n^2)^2}\,da\\&=&\frac{1}{8n\,\text{AGM}(1,\sqrt{1+s^2})}\leq\frac{1}{8n}(1+s^2)^{-1/4}.\end{eqnarray*}$$

• Thank you very much! This should speed up the algorithm, once I get a handle on which approximation works where. Also should help with the other similar integrals, as they are just a part of the larger problem – Yuriy S Nov 15 '18 at 19:11
• I don't think the $1/(e^{\pi n s} \sqrt {2 n s})$ part is true, there are powers of $n$ that don't cancel out. I've added an answer. – Maxim Nov 15 '18 at 20:45
• @Maxim: you're right, now fixing. – Jack D'Aurizio Nov 15 '18 at 20:47
• @JackD'Aurizio, your integral expression turned out to be very helpful, as a follow up, maybe you have any advice here? – Yuriy S Nov 16 '18 at 0:23
• The second integral is great for Gauss-Laguerre quadrature, it's fast and accurate for a few points. This works for me much better than any other ways I tried, so thank you again – Yuriy S Nov 16 '18 at 1:53

The asymptotic for large $$n$$ is determined by the behaviour of the integrand at $$x = \pm 1$$. Choosing a contour going in the direction $$i$$ from $$x = -1$$ and then in the direction $$-i$$ towards $$x = 1$$ and expanding the non-exponential part, we have $$\frac 1 {\sqrt {x^2 + s^2}} \bigg\rvert_{x = -1 + i \xi} = \frac 1 {\sqrt {1 + s^2}} + \frac {i \xi} {(1 + s^2)^{3/2}} + O(\xi^2), \\ \frac 1 {\sqrt {x^2 + s^2}} \bigg\rvert_{x = 1 + i \xi} = \frac 1 {\sqrt {1 + s^2}} - \frac {i \xi} {(1 + s^2)^{3/2}} + O(\xi^2).$$ The contributions from the first terms will cancel out, leaving $$I(\pi n, s) = \frac 1 2\int_{-1}^1 \frac {e^{i \pi n x}} {\sqrt {x^2 + s^2}} dx \sim i \int_0^\infty \frac {i \xi} {(1 + s^2)^{3/2}} e^{-i \pi n - \pi n \xi} d\xi = \\ \frac {(-1)^{n - 1}} {\pi^2 (1 + s^2)^{3/2} n^2}, \quad n \to \infty, \,n \in \mathbb N.$$

• Thank you, Maxim, this was also very helpful – Yuriy S Nov 16 '18 at 0:43

Just a comment

The integral is the real part of $$\int^1_0\frac{e^{ibx}}{\sqrt{s^2+x^2}}dx$$

If we make a substitution $$x=is\cos t$$, without dealing with branch cuts rigorously we can obtain

$$-i\int^{\cos^{-1}(-i/s)}_{\pi/2}e^{-bs\cos t}dt$$

Essentially, $$I(b,s)=\Im~ \int^{\cos^{-1}(-i/s)}_{\pi/2}e^{-bs\cos t}dt$$ or $$I(b,s)=-\Im~ \int^{\sin^{-1}(-i/s)}_{0}e^{-bs\sin t}dt$$

which suggests a relation with Bessel functions. However, due to the upper and lower limits not being $$\pm\pi$$, the normal Bessel functions cannot be used. I think there might be a need to define some kind of ‘incomplete Bessel function’ to write the integral in closed form.