# gamma function type complex integral estimation?

Is there any way to compute or estimate the following integrals? Surely this type of thing must be known, but Wolfram and other online integrators are giving me either useless or zero information:

∫2π0xne±ixdx\int_{0}^{2\pi}x^n e^{\pm ix}dx where n≥1n\geq1 is an integer.

=================

If it were f: R→Rf:\ \mathbb R\to\mathbb R, we could use comparison.
– Simple Art
Oct 20 at 21:34

You can compute the integral via integration by parts, or by expanding the exponential into its power series and integrating termwise. Apparently, those are not the type of result you want, so can you clarify what type of result/estimate you want?
– Daniel Fischer♦
Oct 20 at 21:44

I suppose I am mainly looking for a numerical estimation of really any kind. Do you recommend parts or expansion for this?
– Johnny Apple
Oct 20 at 21:46

=================

3

=================

Integration by parts gives
an=∫2π0xneixdx=−i(2π)n+in∫2π0xn−1eixdx=−i(2π)n+inan−1=inn!n∑k=1(−i2π)kik!=n!∞∑k=1(2π)n+k(−i)k−1(n+k)!
\begin{align}
a_n
&=\int_0^{2\pi}x^ne^{ix}\,\mathrm{d}x\tag{1}\\
&=-i(2\pi)^n+in\int_0^{2\pi}x^{n-1}e^{ix}\,\mathrm{d}x\tag{2}\\[6pt]
&=-i(2\pi)^n+ina_{n-1}\tag{3}\\[6pt]
&=i^nn!\sum_{k=1}^n\frac{(-i2\pi)^k}{ik!}\tag{4}\\
&=n!\sum_{k=1}^\infty\frac{(2\pi)^{n+k}(-i)^{k-1}}{(n+k)!}\tag{5}
\end{align}

Explanation:
(1)(1): define ana_n
(2)(2): integrate by parts
(3)(3): rewrite (2)(2) in terms of (1)(1)
(4)(4): solve the recursion from (3)(3)
(5)(5): use ∞∑k=1(−i2π)kk!=e−2πi−1=0\sum\limits_{k=1}^\infty\frac{(-i2\pi)^k}{k!}=e^{-2\pi i}-1=0

The real and imaginary parts of (5)(5) give the asymptotic expansions
∫2π0xncos(x)dx=(2π)n+1n+1−(2π)n+3(n+1)(n+2)(n+3)+O((2π)nn5)
\int_0^{2\pi}x^n\cos(x)\,\mathrm{d}x=\frac{(2\pi)^{n+1}}{n+1}-\frac{(2\pi)^{n+3}}{(n+1)(n+2)(n+3)}+O\left(\frac{(2\pi)^n}{n^5}\right)\tag{6}

and
∫2π0xnsin(x)dx=−(2π)n+2(n+1)(n+2)+(2π)n+4(n+1)(n+2)(n+3)(n+4)+O((2π)nn6)
\int_0^{2\pi}x^n\sin(x)\,\mathrm{d}x=-\frac{(2\pi)^{n+2}}{(n+1)(n+2)}+\frac{(2\pi)^{n+4}}{(n+1)(n+2)(n+3)(n+4)}+O\left(\frac{(2\pi)^n}{n^6}\right)\tag{7}

I also got the leading term of (6) using the approximation-to-the-identity argument, but I never expected that such a precise expansion can be obtained by a simple and elegant computation. (+1)
– Sangchul Lee
Oct 21 at 4:18

It is possible due to the fact that ∞∑k=1(−i2π)kk!=e−2πi−1=0\sum_{k=1}^\infty\frac{(-i2\pi)^k}{k!}=e^{-2\pi i}-1=0
– robjohn♦
2 days ago

@robjohn, elegant!
– G Cab
2 days ago

Thanks so much for this! I hadn’t realized (5), or life would have been a little easier!
– Johnny Apple
2 days ago

We can write
∫2πx=0xne±ixdx=∫2πx=0xn(cosx±isinx)dx
\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n\,} e^{\, \pm \,i\,x} \,dx} = \int_{\,x\, = \,0}^{\,2\pi } {x^{\,n\,} \left( {\cos x \pm \,i\sin x} \right)\,dx}

And we can start and compute the integral by parts
∫2πx=0xncosxdx=∫2πx=0xnd(sinx)=(xnsinx)|2πx=0−n∫2πx=0xn−1sinxdx==−n∫2πx=0xn−1sinxdx∫2πx=0xnsinxdx=−∫2πx=0xnd(cosx)=(−xncosx)|2πx=0+n∫2πx=0xn−1cosxdx==[0=n]−2nπn+n∫2πx=0xn−1cosxdx
\begin{gathered}
\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n\,} \cos x\,dx} = \int_{\,x\, = \,0}^{\,2\pi } {x^{\,n\,} d\left( {\sin x} \right)} = \left. {\left( {x^{\,n\,} \sin x} \right)} \right|_{\,x\, = \,0}^{\,2\pi } – n\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n – 1\,} \sin x\,dx} = \hfill \\
= – n\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n – 1\,} \sin x\,dx} \hfill \\
\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n\,} \sin x\,dx} = – \int_{\,x\, = \,0}^{\,2\pi } {x^{\,n\,} d\left( {\cos x} \right)} = \left. {\left( { – x^{\,n\,} \cos x} \right)} \right|_{\,x\, = \,0}^{\,2\pi } + n\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n – 1\,} \cos x\,dx} = \hfill \\
= \left[ {0 = n} \right] – 2^{\,n\,} \pi ^{\,n\,} + n\int_{\,x\, = \,0}^{\,2\pi } {x^{\,n – 1\,} \cos x\,dx} \hfill \\
\end{gathered}

which translates into a double FDE.

Now, if your scope is to calculate the integrals on a computer, then you can use this result iteratively.

Thanks so much!
– Johnny Apple
2 days ago

Make the substitution ∓ix=u\mp ix=u and ∓idx=du\mp idx=du.

∫2π0xne±ixdx=±i∫∓2πi0(∓iu)ne−udu=−(∓i)n+1∫∓2πi0une−udu=−(∓i)n+1γ(n+1,∓2πi)\begin{align}\int_0^{2\pi}x^ne^{\pm ix}dx&=\pm i\int_0^{\mp2\pi i}(\mp iu)^ne^{-u}du\\
&=-(\mp i)^{n+1}\int_0^{\mp2\pi i}u^ne^{-u}du\\
&=-(\mp i)^{n+1}\gamma(n+1,\mp2\pi i)
\end{align}

where γ(n,x)\gamma(n,x) is the incomplete gamma function.

An example of an approximation:

γ(n,x)≈xn(1n−x1!(n+1)+x22!(n+2)−⋯+(−x)kk!(n+k))\gamma(n,x)\approx x^n\left(\frac1n-\frac x{1!(n+1)}+\frac{x^2}{2!(n+2)}-\dots+\frac{(-x)^k}{k!(n+k)}\right)

for very large kk.

Sure, but how do I then estimate the incomplete gamma function given?
– Johnny Apple
Oct 20 at 21:46

@JohnnyApple You may find everything in the link I will provide in my answer momentarily.
– Simple Art
Oct 20 at 21:47

I have been to the wiki page on this function. Where is there information on estimation?
– Johnny Apple
Oct 20 at 21:57

@JohnnyApple You may have found many expansion of the lower incomplete gamma function, which provide approximations.
– Simple Art
Oct 20 at 22:17

1

What is ss in the asymptotic expansion?
– robjohn♦
2 days ago