# Evaluating $\int_{1}^{\infty}\exp(-(x(2n-x)/b)^2)\,\mathrm dx$

$$I_1=\int_1^{\infty}\exp\left(-\left(\frac{x(2n-x)}{b}\right)^2\right)\mathrm dx,$$ I set $$t=\frac{x(2n-x)}{b},$$ and, solving for $x$ and $dt$ I got $$I_1=\frac{b}{2 n} \int_1^{\infty} e^{-t^2}\left(1-\frac{bt}{n^2}\right)^{\frac12}\mathrm dt.$$

I then expand $$\left(1-\frac{bt}{n^2}\right)^{\frac12} \approx 1+\frac{bt}{2n^2}$$ in the first two terms of Binomial series, and obtain something like $$I_1 \approx \frac{b}{2n}\left(\frac{\sqrt{\pi}(1-\mathrm{erf}(1))}{2}+\frac{b}{4n^2e}\right).$$

I am not 100% sure about this derivation (although the result is sensible), especially about the substitution, it seems I could misused integration of Gaussian function here.

-
Check your change of variables. The limits for the integral with respect to $t$ are obviously wrong and so your approximation, which uses the limits, is wrong. Also, your approach may have problems if $b$ is large. – Steve Jun 26 '11 at 4:10
@Steve: is this due to binomial expansion? – sigma.z.1980 Jun 26 '11 at 5:59

The first two terms of the binomial expansion will only be a good approximation if $t$ is small, but you're integrating for $t$ out to infinity, so this seems like a losing proposition. You might be able to rescue something by splitting the range of integration into two parts, using that approximation for small $t$, and something else for large $t$ (where the integrand will be small anyway, so this might actually work).

-
As I understand, binomial or Taylor series expansion is good if the interval around the point of expansion is relatively small, which is not my situation. Instead, I'm considering choosing some large $\mu$ instead of infinity as an upper bound and breaking the integral into $\mu$ subsequent intervals $I_{1}\sum_{k}^{\mu} I_{k}$ and approximating each integral with something like Clenshaw-Curties or Simpson rule. Mind you the function is monotonic and nonincreasing – sigma.z.1980 Jun 28 '11 at 3:46
so I'm thinking if it's reasonable to break it down into $\mu$ intervals and then expand each of them into Tyalor series around the midpoint, and then sum up the resulting polynomials or something liek this. – sigma.z.1980 Jun 28 '11 at 4:23

Your substitution is right, except that it should have come out $$\int \frac{e^{-t^2}}{\sqrt{1-\frac{b t}{n^2}}} \, dt$$ rather than $$\int e^{-t^2} \sqrt{1-\frac{b t}{n^2}} \, dt$$

-
When I say the substitution is right, I just mean that it is formally correct. I've not checked for problems related to the range over which either of the integrals is being evaluated, and in fact my spidey sense is tingling. – tzs Jun 26 '11 at 10:42

Although this integral converges for any complex number $n$ and any non-zero complex number $b$ , I only able to tackle the cases of real numbers $n$ and $b$ .

Case $1$: $n=0$

Then $\int_1^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$

$=\int_1^\infty e^{-\frac{x^4}{b^2}}~dx$

$=\int_\frac{1}{b^2}^\infty e^{-\frac{\bigl(\sqrt{|b|}\sqrt[4]x\bigr)^4}{b^2}}~d\left(\sqrt{|b|}\sqrt[4]x\right)$

$=\dfrac{\sqrt{|b|}}{4}\int_\frac{1}{b^2}^\infty x^{-\frac{3}{4}}e^{-x}~dx$

$=\dfrac{\sqrt{|b|}}{4}\Gamma\left(\dfrac{1}{4},\dfrac{1}{b^2}\right)$

Case $2$: $n\neq0$

Consider $\int e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$ ,

$\int e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$

$=\int e^{-\frac{x^2(2n-x)^2}{b^2}}~dx$

$=\int\sum\limits_{m=0}^\infty\dfrac{(-1)^mx^{2m}(2n-x)^{2m}}{b^{2m}m!}dx$

$=\int\sum\limits_{m=0}^\infty\sum\limits_{k=0}^{2m}\dfrac{(-1)^mx^{2m}C_k^{2m}(-1)^kx^k(2n)^{2m-k}}{b^{2m}m!}dx$

$=\int\sum\limits_{m=0}^\infty\sum\limits_{k=0}^{2m}\dfrac{(-1)^{m+k}2^{2m-k}n^{2m-k}(2m)!x^{2m+k}}{b^{2m}m!k!(2m-k)!}dx$

$=\sum\limits_{m=0}^\infty\sum\limits_{k=0}^{2m}\dfrac{(-1)^{m+k}2^{2m-k}n^{2m-k}(2m)!x^{2m+k+1}}{b^{2m}m!k!(2m-k)!(2m+k+1)}+C$

However, the above result cannot substitute $\infty$ , so we can divide $\int_1^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$ as $\int_1^ae^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx+\int_a^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$ , $\int_1^ae^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$ use the above antiderivative result, and find the suitable value of $a$ such that $\int_a^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$ can express as known special functions.

I only able to find the suitable value of $a$ for the case of real numbers $n$ and $b$ .

$\int_a^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$

$=\int_{a-n}^\infty e^{-\left(\frac{(n+x)(n-x)}{b}\right)^2}~d(n+x)$

$=\int_{a-n}^\infty e^{-\frac{(n^2-x^2)^2}{b^2}}~dx$

$=\int_{a-n}^\infty e^{-\frac{x^4-2n^2x^2+n^4}{b^2}}~dx$

$=e^{-\frac{n^4}{b^2}}\int_{a-n}^\infty e^{-\frac{x^2(x^2-2n^2)}{b^2}}~dx$

$\because\int_0^\infty e^{-\frac{x^2(x^2-2n^2)}{b^2}}~dx$

$=\int_0^{\sqrt2|n|}e^{-\frac{x^2(x^2-2n^2)}{b^2}}~dx+\int_{\sqrt2|n|}^\infty e^{-\frac{x^2(x^2-2n^2)}{b^2}}~dx$

$=\int_0^\frac{\pi}{2}e^{-\frac{(\sqrt2|n|\sin x)^2((\sqrt2|n|\sin x)^2-2n^2)}{b^2}}~d(\sqrt2|n|\sin x)+\int_0^\infty e^{-\frac{(\sqrt2|n|\cosh x)^2((\sqrt2|n|\cosh x)^2-2n^2)}{b^2}}~d(\sqrt2|n|\cosh x)$

$=\sqrt2|n|\left(\int_0^\frac{\pi}{2}e^{-\frac{2n^2(\sin^2x)(2n^2\sin^2x-2n^2)}{b^2}}\cos x~dx+\int_0^\infty e^{-\frac{2n^2(\cosh^2x)(2n^2\cosh^2x-2n^2)}{b^2}}\sinh x~dx\right)$

$=\sqrt2|n|\left(\int_0^\frac{\pi}{2}e^\frac{4n^4\sin^2x\cos^2x}{b^2}\cos x~dx+\int_0^\infty e^{-\frac{4n^4\sinh^2x\cosh^2x}{b^2}}\sinh x~dx\right)$

$=\sqrt2|n|\left(\int_0^\frac{\pi}{2}e^\frac{n^4\sin^22x}{b^2}\cos x~dx+\int_0^\infty e^{-\frac{n^4\sinh^22x}{b^2}}\sinh x~dx\right)$

$=\sqrt2|n|\left(\int_0^\frac{\pi}{2}e^\frac{n^4(1-\cos4x)}{2b^2}\cos x~dx+\int_0^\infty e^{-\frac{n^4(\cosh 4x-1)}{2b^2}}\sinh x~dx\right)$

$=\sqrt2|n|e^\frac{n^4}{2b^2}\left(\int_0^\frac{\pi}{2}e^{-\frac{n^4\cos4x}{2b^2}}\cos x~dx+\int_0^\infty e^{-\frac{n^4\cosh 4x}{2b^2}}\sinh x~dx\right)$

$=\sqrt2|n|e^\frac{n^4}{2b^2}\left(\int_0^{2\pi}e^{-\frac{n^4\cos x}{2b^2}}\cos\dfrac{x}{4}d\left(\dfrac{x}{4}\right)+\int_0^\infty e^{-\frac{n^4\cosh x}{2b^2}}\sinh\dfrac{x}{4}d\left(\dfrac{x}{4}\right)\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{2\sqrt2}\left(\int_0^{2\pi}e^{-\frac{n^4\cos x}{2b^2}}\cos\dfrac{x}{4}dx+\int_0^\infty e^{-\frac{n^4\cosh x}{2b^2}}\sinh\dfrac{x}{4}dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{2\sqrt2}\left(\int_{-\pi}^\pi e^{-\frac{n^4\cos(\pi+x)}{2b^2}}\cos\dfrac{\pi+x}{4}d(\pi+x)+\int_0^\infty e^{-\frac{n^4\cosh x}{2b^2}}\sinh\dfrac{x}{4}dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{2\sqrt2}\left(\int_{-\pi}^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{\pi}{4}\cos\dfrac{x}{4}dx-\int_{-\pi}^\pi e^\frac{n^4\cos x}{2b^2}\sin\dfrac{\pi}{4}\sin\dfrac{x}{4}dx+\int_0^\infty e^{-\frac{n^4\cosh x}{2b^2}}\sinh\dfrac{x}{4}dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{4}\left(\int_{-\pi}^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx-\int_{-\pi}^\pi e^\frac{n^4\cos x}{2b^2}\sin\dfrac{x}{4}dx+\dfrac{1}{\sqrt2}\int_0^\infty e^{\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx-\dfrac{1}{\sqrt2}\int_0^\infty e^{-\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{4}\left(\int_{-\pi}^0e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx+\int_0^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx-\int_{-\pi}^0e^\frac{n^4\cos x}{2b^2}\sin\dfrac{x}{4}dx-\int_0^\pi e^\frac{n^4\cos x}{2b^2}\sin\dfrac{x}{4}dx+\dfrac{1}{\sqrt2}\int_0^\infty e^{\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx-\dfrac{1}{\sqrt2}\int_0^\infty e^{-\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{4}\left(\int_\pi^0e^\frac{n^4\cos(-x)}{2b^2}\cos\dfrac{-x}{4}d(-x)+\int_0^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx-\int_\pi^0e^\frac{n^4\cos(-x)}{2b^2}\sin\dfrac{-x}{4}d(-x)-\int_0^\pi e^\frac{n^4\cos x}{2b^2}\sin\dfrac{x}{4}dx+\dfrac{1}{\sqrt2}\int_0^\infty e^{\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx-\dfrac{1}{\sqrt2}\int_0^\infty e^{-\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{4}\left(\int_0^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx+\int_0^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx+\int_0^\pi e^\frac{n^4\cos x}{2b^2}\sin\dfrac{x}{4}dx-\int_0^\pi e^\frac{n^4\cos x}{2b^2}\sin\dfrac{x}{4}dx+\dfrac{1}{\sqrt2}\int_0^\infty e^{\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx-\dfrac{1}{\sqrt2}\int_0^\infty e^{-\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx\right)$

$=\dfrac{|n|e^\frac{n^4}{2b^2}}{4}\left(2\int_0^\pi e^\frac{n^4\cos x}{2b^2}\cos\dfrac{x}{4}dx+\dfrac{1}{\sqrt2}\int_0^\infty e^{\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx-\dfrac{1}{\sqrt2}\int_0^\infty e^{-\frac{x}{4}-\frac{n^4\cosh x}{2b^2}}~dx\right)$

$=\dfrac{|n|\pi e^\frac{n^4}{2b^2}}{4}\left(I_\frac{1}{4}\left(\dfrac{n^4}{2b^2}\right)+I_{-\frac{1}{4}}\left(\dfrac{n^4}{2b^2}\right)\right)$ (according to http://people.math.sfu.ca/~cbm/aands/page_376.htm)

$\therefore a$ should take $n$ and $\int_n^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx=\dfrac{|n|\pi e^{-\frac{n^4}{2b^2}}}{4}\left(I_\frac{1}{4}\left(\dfrac{n^4}{2b^2}\right)+I_{-\frac{1}{4}}\left(\dfrac{n^4}{2b^2}\right)\right)$

Hence when $n$ and $b$ are real numbers, $\int_1^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$

$=\int_1^ne^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx+\int_n^\infty e^{-\left(\frac{x(2n-x)}{b}\right)^2}~dx$

$=\left[\sum\limits_{m=0}^\infty\sum\limits_{k=0}^{2m}\dfrac{(-1)^{m+k}2^{2m-k}n^{2m-k}(2m)!x^{2m+k+1}}{b^{2m}m!k!(2m-k)!(2m+k+1)}\right]_1^n+\dfrac{|n|\pi e^{-\frac{n^4}{2b^2}}}{4}\left(I_\frac{1}{4}\left(\dfrac{n^4}{2b^2}\right)+I_{-\frac{1}{4}}\left(\dfrac{n^4}{2b^2}\right)\right)$

$=\sum\limits_{m=0}^\infty\sum\limits_{k=0}^{2m}\dfrac{(-1)^{m+k}2^{2m-k}n^{2m-k}(2m)!(n^{2m+k+1}-1)}{b^{2m}m!k!(2m-k)!(2m+k+1)}+\dfrac{|n|\pi e^{-\frac{n^4}{2b^2}}}{4}\left(I_\frac{1}{4}\left(\dfrac{n^4}{2b^2}\right)+I_{-\frac{1}{4}}\left(\dfrac{n^4}{2b^2}\right)\right)$

-
The Bessel terms should simplify a bit more if you use the modified Bessel function of the second kind. – TeeJay Dec 4 '13 at 9:51