Solution (source code)

= Solution

<Differentiation under the integral sign> first gives
$$
I'(x)=\int_0^\pi \cos\theta\,e^{x\cos\theta}\,d\theta.
$$
On the other hand,
$$
\frac d{d\theta}\left(\sin\theta\,e^{x\cos\theta}\right)
=\cos\theta\,e^{x\cos\theta}
-x\sin^2\theta\,e^{x\cos\theta}.
$$
Its integral is zero because $\sin\theta$ vanishes at both endpoints. Hence
$$
\boxed{I'(x)=\int_0^\pi x\sin^2\theta\,e^{x\cos\theta}\,d\theta}.
$$

Differentiating once more,
$$
I''(x)=\int_0^\pi\cos^2\theta\,e^{x\cos\theta}\,d\theta.
$$
For $x\ne0$, the preceding identity and $\sin^2\theta+\cos^2\theta=1$ give
$$
I''+\frac1xI'-I
=\int_0^\pi(\cos^2\theta+\sin^2\theta-1)e^{x\cos\theta}\,d\theta=0.
$$
The equation extends through $x=0$ in its regular limiting form.