Bessel function integral How to solve the integral for $J_1{(2x\sin{\frac{\theta}{2}})}$ at $[0,\pi]$? If solving by Matlab, please provide me the source. Thank you!

A simple analytical result is derived from the series representation of $J_1$:
$$J_1(z) = \sum_{k=0}^{\infty} \frac{(-1)^k}{k! (k+1)!} \left ( \frac{z}{2}\right )^{2 k+1} $$
as well as the integral
$$\int_0^{\pi/2} du \, \sin^{2 k+1}{u} = \frac{2^{2 k}}{\displaystyle (2 k+1) \binom{2 k}{k}}$$
Thus
$$\begin{align}\int_0^{\pi} d\theta \, J_1\left (2 x \sin{\frac{\theta}{2}} \right ) &= \sum_{k=0}^{\infty} \frac{(-1)^k}{k! (k+1)!} x^{2 k+1} \int_0^{\pi} d\theta \, \sin^{2 k+1} {\frac{\theta}{2}} \\ &= 2 \sum_{k=0}^{\infty} \frac{(-1)^k}{k! (k+1)!} x^{2 k+1} \int_0^{\pi/2} du \, \sin^{2 k+1}{u} \\ &= \sum_{k=0}^{\infty} \frac{(-1)^k}{(k+1)(2 k+1)} \frac{(2 x)^{2 k+1}}{(2 k)!}\\ &= \frac1{x}\sum_{k=0}^{\infty} \frac{(-1)^k}{(2 k+2)!} (2 x)^{2 k+2}\\ &= \frac{1-\cos{2 x}}{x}\end{align} $$
