How do you integrate $\cos(x^n)$, specifically for $n=-1$?

How does one integrate $\cos(x^{-1})$?

I understand that the function is not defined at zero, but it is well defined, continuous, and real over the rest of $\mathbb{R}$. Nonetheless, when I put $\int \cos(x^{-1})\; dx$ into a computer algebra system, the result is in terms of imaginary units and special functions with which I'm not familiar.

Surely this function has been addressed (else how would the CAS know the answer) but I don't see it on integration tables anywhere and Google turns up empty-handed. Can someone derive the answer for me? or at least point me to a good resource for it?

-

Substituting $u=1/x$ and then integrating by parts yields

$$\begin{eqnarray} \int\cos\left(\frac1x\right)\mathrm dx &=& -\int\frac{\cos u}{u^2}\mathrm du \\ &=& \frac{\cos u}{u}+\int\frac{\sin u}{u}\mathrm du\;. \\ \end{eqnarray}$$

That last integral is called the sine integral and denoted by $\operatorname{Si}$. Thus we have

$$\begin{eqnarray} \int\cos\left(\frac1x\right)\mathrm dx &=& \frac{\cos u}{u}+\operatorname{Si}(u) \\ &=&x\cos\left(\frac1x\right)+\operatorname{Si}\left(\frac1x\right) \end{eqnarray}$$

(plus a constant).

-
Thanks. I suppose I should have been able to work that out on my own huh? :) – AdamRedwine Dec 15 '11 at 14:11
"should have been able to" is very relative. This only counts as "worked out" because the sine integral has a name and a symbol and the one that you were trying to calculate doesn't -- unless you'd already heard of the sine integral, none of these steps would have appeared to bring you any closer to anything integrable in closed form, so its not a matter of your integration skills but of your knowledge of special functions, which will expand over time. – joriki Dec 15 '11 at 14:16
Another way to end: Since it is known that Si is not an elementary function, this calculation shows that $\int \cos(x^{-1})\,dx$ also is not elementary. – GEdgar Dec 15 '11 at 14:59
I am still baffled by the complex part of the answer. I understand the link between trig functions and complex numbers provided by Euler's formula, but how on Earth do they show up in this case? The integral is just the area under the curve, but when I take $\int_1^x cos(2\pi/t) dt$, the result has an imaginary component even on the real line. What's going on here? – AdamRedwine Dec 15 '11 at 15:33
I suppose I should also note that it looks like the integrals of $\cos(1/x)$ and that of $\cos(a/x)$ where $a \neq 1$ are different animals. I cannot conceive of how this could be and I feel like I'm kind of walking in the woods here. – AdamRedwine Dec 15 '11 at 15:53