Approximating Fresnel integrals with standard functions

I would like to approximate the Fresnel S and Fresnel C with standard functions.

I've started with the $S(x)$ function:

$$approxS(x) = sgn(x) * \left ( sgn(x)* \left ( \frac{ \sin( \frac{x^2}{2} ) }{x} \right) + 0.5 \right )$$

The result looks like this:

This is the FresnelS function:

The difference ( $approxS(x) - S(x)$ ):

What do I wrong? How could I approximate it better?

• well to be fair to yourself, the error looks worse than it is due to the scale of your axes. – Chill2Macht Apr 30 '16 at 17:29
• over what range of values of x? – jim Apr 30 '16 at 17:35
• $x \in \mathbb{R}$ – Iter Ator Apr 30 '16 at 17:42
• You want one formula that is accurate everywhere? – jim Apr 30 '16 at 21:51
• I am looking for a forula, which can approximate the Fresnel function everywhere as close, as possible – Iter Ator Apr 30 '16 at 21:54

According to https://en.wikipedia.org/wiki/Fresnel_integral, for large $x$, $S(x) =\sqrt{\dfrac{\pi}{2}}\left(\dfrac{sign(x)}{2} -(1+O(x^{-4}))\left(\dfrac{\cos(x^2)}{x\sqrt{2\pi}} +\dfrac{\sin(x^2)}{x^3\sqrt{8\pi}} \right)\right)$ and $C(x) =\sqrt{\dfrac{\pi}{2}}\left(\dfrac{sign(x)}{2} +(1+O(x^{-4}))\left(\dfrac{\sin(x^2)}{x\sqrt{2\pi}} +\dfrac{\cos(x^2)}{x^3\sqrt{8\pi}} \right)\right)$.
You can get the direct power series (good for small $x$) by expanding the integral term-by-term.