$\int_{-\frac{w}{2}}^\frac{w}{2} \cos\left(\sqrt{x^2 + (y + h)^2}\right)\,dh$ I'm working on a diffraction simulator. In order to take into account for slit-width, I need to take this integral:
$$\int_{-\frac{w}{2}}^\frac{w}{2} \cos\left(\sqrt{x^2 + (y + h)^2}\right)\,dh$$
Where $x$ and $y$ are the coordinates of the point for which the amplitude is computed and $w$ is the width of the slit. When developing and simplifying, I get:
$$\int_{-\frac{w}{2}}^\frac{w}{2} \cos\left(\sqrt{h^2 + Ah + B}\right)\,dh$$
Where $A = 2y, B = x^2 + y^2$.
I tried u-substitution, with $u^2 = h^2 + Ah + B$, yielding $dh = \frac{2udu}{2h + A}$ and thus being rather useless.
Note: I can't approximate the integral by small steps for performance reasons.
Also, if there is no general solution (which seems pretty likely), is there any computationally efficient way of approximating it?
Thanks in advance
 A: As you, I am more than skeptical about a closed form.
For an approximation, you  could try this $1,400$ years old approximation
$$\cos(t) \simeq\frac{\pi ^2-4t^2}{\pi ^2+t^2}\qquad \text{for} \qquad-\frac \pi 2 \leq t\leq\frac \pi 2$$
This would give
$$\int \cos \left(\sqrt{(h+y)^2+x^2}\right)\sim \frac{5 \pi ^2 }{\sqrt{x^2+\pi ^2}}\tan ^{-1}\left(\frac{h+y}{\sqrt{x^2+\pi
   ^2}}\right)-4 h$$
This would give for your integral
$$\frac{5 \pi ^2}{\sqrt{x^2+\pi ^2}}\tan ^{-1}\left(\frac{4 \omega \sqrt{x^2+\pi ^2} }{4 \left(x^2+y^2+\pi
   ^2\right)-\omega ^2}\right) -4 \omega$$
Edit
Concerning the approximation of $$\cos(x)\qquad \text{for} \qquad-\frac \pi 2 \leq t\leq\frac \pi 2$$ for easy integrations, we could use the $[2n,2]$ Padé approximants $(P_n)$. They write
$$\left(
\begin{array}{ccc}
 n & \text{numerator} & \text{denominator} \\
 1 & 12-5 x^2 & x^2+12 \\
 2 & 3 x^4-56 x^2+120 & 4 x^2+120 \\
 3 & -13 x^6+660 x^4-9720 x^2+20160 & 360 \left(x^2+56\right) \\
 4 & 17 x^8-1680 x^6+65520 x^4-887040 x^2+1814400 & 20160 \left(x^2+90\right)
\end{array}
\right)$$
To check their quality, considering the norm
$$\Phi_n=\int_{-\frac \pi 2}^{+\frac \pi 2} \Big[\cos(x)-P_n\Big]^2\, dx$$
$$\left(
\begin{array}{cc}
 n &  \Phi_n \\
 1 & 1.42 \times 10^{-4} \\
 2 & 9.09 \times 10^{-8} \\
 3 & 2.30 \times 10^{-11}\\
 4 & 5.47 \times 10^{-15}
\end{array}
\right)$$ while
$$\int_{-\frac \pi 2}^{+\frac \pi 2} \Bigg[\cos(x)-\frac{\pi ^2-4x^2}{\pi ^2+x^2}\Bigg]^2\, dx \sim  2.98 \times 10^{-6}$$
