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:
$$\int_{0}^{2\pi}x^n e^{\pm ix}dx$$ where $n\geq1$ is an integer.
Integration by parts gives $$ \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)$: define $a_n$
$(2)$: integrate by parts
$(3)$: rewrite $(2)$ in terms of $(1)$
$(4)$: solve the recursion from $(3)$
$(5)$: use $\sum\limits_{k=1}^\infty\frac{(-i2\pi)^k}{k!}=e^{-2\pi i}-1=0$
The real and imaginary parts of $(5)$ give the asymptotic expansions $$ \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 $$ \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} $$