Calculating the improper integral $\int _{1}^{\infty}\frac{e^{\sin x}\cos x}{x}\,dx$
It is pretty obvious that there cannot be an elementary result for the given integral, nor one using "mild" special functions like Bessel and error functions.
So we will numerically integrate it. The problem, however, is that the integrand is oscillatory as $x\to\infty$ and only decays like $\frac1x$, which means the following approach is needed:
- Break up $[1,\infty)$ at the integrand zeros: $\frac\pi2,\frac{3\pi}2,\frac{5\pi}2\dots$
- Compute the integral over each segment, using series acceleration techniques to "predict" future values, then sum everything up
In mpmath this can be accomplished as
quadosc(lambda x: exp(sin(x))*cos(x)/x, [1, inf], period=2*pi)
and this returns the accurate result
$$-0.379597645637239886\dots$$
We have that, integrating by parts $$ \eqalign{ & I = \int_1^\infty {e^{\,\sin x} {{\cos x} \over x}dx} = \int_1^\infty {{1 \over x}d\left( {e^{\,\sin x} } \right)} = \cr & = \left. {{{e^{\,\sin x} } \over x}} \right|_1^\infty - \int_1^\infty {e^{\,\sin x} d\left( {{1 \over x}} \right)} = - e^{\,\sin 1} + \int_1^\infty {{{e^{\,\sin x} } \over {x^{\,2} }}dx} = \cr & = - e^{\,\sin 1} + J \cr} $$ with the advantage of having replaced $1/x$ with $1/x^2$.
Then being $\exp(\sin x)$ periodic $$ \eqalign{ & J = \int_1^\infty {{{e^{\,\sin x} } \over {x^{\,2} }}dx} = \int_1^{1 + 2\pi } {{{e^{\,\sin x} } \over {x^{\,2} }}dx} + \int_{1 + 2\pi }^{1 + 4\pi } {{{e^{\,\sin x} } \over {x^{\,2} }}dx} + \cdots = \cr & = \sum\limits_{0\, \le \,k} {\int_{1 + k2\pi }^{1 + \left( {k + 1} \right)2\pi } {{{e^{\,\sin x} } \over {x^{\,2} }}dx} } = \sum\limits_{0\, \le \,k} {\int_0^{2\pi } {{{e^{\,\sin \left( {x + 1} \right)} } \over {\left( {x + 1 + k2\pi } \right)^{\,2} }}dx} } = \cr & = {1 \over {4\pi ^{\,2} }}\int_0^{2\pi } {e^{\,\sin \left( {x + 1} \right)} \left( {\sum\limits_{0\, \le \,k} {{1 \over {\left( {{{\left( {x + 1} \right)} \over {2\pi }} + k} \right)^{\,2} }}} } \right)dx} = \cr & = {1 \over {4\pi ^{\,2} }}\int_0^{2\pi } {e^{\,\sin \left( {x + 1} \right)} \zeta \left( {2,{{x + 1} \over {2\pi }}} \right)dx} = \cr & = {1 \over {4\pi ^{\,2} }}\int_0^{2\pi } {e^{\,\sin \left( {x + 1} \right)} \psi ^{\left( 1 \right)} \left( {{{x + 1} \over {2\pi }}} \right)dx} = \cr & = {1 \over {2\pi }}\int_0^{2\pi } {e^{\,\sin \left( {x + 1} \right)} \psi ^{\left( 1 \right)} \left( {{{x + 1} \over {2\pi }}} \right) d\left( {{{x + 1} \over {2\pi }}} \right)} = \cr & = {1 \over {2\pi }}\int_{{1 \over {2\pi }}}^{{1 \over {2\pi }} + 1} {e^{\,\sin \left( {2\pi t} \right)} \psi ^{\left( 1 \right)} \left( t \right)d\left( t \right)} \cr } $$ where $\psi ^{\left( 1 \right)} \left( t \right)$ denotes the Trigamma Function.
So we have reduced the improper integral to a proper integral,
much more manageable by numeric integration.
My CAS gives:
$$
\eqalign{
& J \approx 1 .94017 \cr
& {\rm I} \approx - \,0.3796 \cr}
$$