# Sum of Bessel functions and integral of exponential of sine or cosine

I'm looking to simplify the following sum of Bessel functions of the first kind: $$\sum_{q=-\infty}^{\infty}\frac{(-)^{q}}{2q+1}e^{iq\theta}I_{q}(\alpha^{2})$$ Motivated by a related question and by taking derivatives w.r.t. the Jacobi-Anger expansion, I've simplified it to this $$\frac{1}{2}e^{-i\theta/2}\left(\intop_{\theta}^{\pi}d\phi\sin\left(\frac{\phi}{2}\right)e^{-\alpha^{2}\cos\phi}+i\intop_{0}^{\theta}d\phi\cos\left(\frac{\phi}{2}\right)e^{-\alpha^{2}\cos\phi}\right)$$ The first integral is actually solvable in Mathematica, so I get $$\frac{1}{2}e^{-i\theta/2}\left(\frac{\sqrt{\pi}e^{\alpha^{2}}\cos\left(\frac{\theta}{2}\right)\text{erf}\left(\alpha\sqrt{\cos\theta+1}\right)}{\alpha\sqrt{\cos\theta+1}}+i\intop_{0}^{\theta}d\phi\cos\left(\frac{\phi}{2}\right)e^{-\alpha^{2}\cos\phi}\right)$$ My questions are

1. How did Mathematica know how to do the first integral?

2. Is there a closed form for the closely related second one?

Probably Mathematica does the substitution $\cos \frac{\phi}{2}=x$ and obtains: \begin{align} \intop_{\theta}^{\pi}&d\phi\sin\left(\frac{\phi}{2}\right)e^{-\alpha^{2}\cos\phi}=2\int\limits_0^{\cos\frac{\theta}{2}} dx e^{-\alpha^2(2x^2-1)} =2e^{\alpha^2}\int\limits_0^{\cos\frac{\theta}{2}} dx e^{-2\alpha^2x^2}\\&=\frac{\sqrt{\pi}e^{\alpha^2}}{\alpha\sqrt{2}}\cdot\frac{2}{\sqrt{\pi}}\int\limits_{0}^{\alpha\sqrt{2}\cos\frac{\theta}{2}}e^{-t^2}dt=\frac{\sqrt{\pi}e^{\alpha^2}}{\alpha\sqrt{2}}\ \text{erf}\left(\alpha\sqrt{2}\cos\frac{\theta}{2}\right),\quad \cos\frac{\theta}{2}\ge 0. \end{align}
The second integral can be calculated by substitution $\sin \frac{\phi}{2}=x$ in the same way as above and expressed through erfi function.