Question: Given the integral:

$$ I = \int\_{0}^{\frac{\pi}{2}} \frac{\sin\left(4\,\cos^2\theta\right)}{2}\,\text{d}\theta$$

thanks to the composite formula of Cavalieri-Simpson I managed to calculate $I = 0.16$ with an error $\epsilon < 0.01$. Could it be done in another way, avoiding numerical calculation? Thank you!

Answer: 
Taking $z=e^{i\theta}$ after changing a bit the initial inetgral we aplly the Cauchy formula in the following, $$I = \int\_{0}^{\frac{\pi}{2}} \frac{\sin\left(4\,\cos^2\theta\right)}{4}\,\text{d}\theta = \int\_{0}^{\pi} \frac{\sin\left(4\,\cos^2\theta\right)}{2}\,\text{d}\theta \\= \int\_{-\pi}^{\pi} \frac{\sin\left(4\,\cos^2\theta\right)}{8}\,\text{d}\theta = \int\_\gamma \frac{\sin\left(z+\frac{1}{z}\right)^2}{8iz}\,\text{d}z= \pi\frac{Res(f,0)}{4}$$

Where $$f(z)=\frac{\sin\left(z+\frac{1}{z}\right)^2}{z}=\frac{\sin\left(z^2+\frac{1}{z^2}+2\right)}{z}~~~~~ 
and ~~~\gamma=\{e^{it}:t\in (-\pi,\pi]\}$$

> 
> Note the singularity at $z=0$ is **essential** hence one should compute the Laurent series of $f$ which will give the Residue. **don't forget to use the Cauchy product involving taylor series of $\sin $ and $\cos$**
> 
> 
> 

at the end you will get:
$$Res(f,0) = \color{red}{\sin(2)\sum\_{n\geq 0}\frac{(-1)^n}{n!^2}}$$

For detailed about this [check this book](https://books.google.de/books/about/Table_of_Integrals_Series_and_Products.html?id=aBgFYxKHUjsC&source=kp_cover&redir_esc=y)
We write
$$
\sin(4\cos^2\theta)=\sin(2+2\cos(2\theta))=\sin 2\cos(2\cos(2\theta))+\cos 2\sin(2\cos(2\theta)).
$$
The second term is odd in the line $\theta=\pi/4$, so it gives no contribution to your integral. Thus
$$
\begin{aligned}
\int\_0^{\pi/2}\frac{1}{2}\sin(4\cos^2\theta)\,d\theta
&=\frac{\sin 2}{2}\int\_0^{\pi/2}\cos(2\cos(2\theta))\,d\theta\\
&=\frac{\sin 2}{4}\int\_0^\pi\cos(2\cos(t))\,dt\\
&=\frac{\sin 2}{4}\pi J\_0(2).
\end{aligned}
$$
Here, $J\_0$ is the Bessel function of the first kind and of order zero.