Fresnel Integral Computation Techniques
Abstract.
This work is an extension of previous work by Alazah et al. [M. Alazah, S. N. Chandler-Wilde, and S. La Porte, Numerische Mathematik, 128(4):635–661, 2014]. We split the computation of the Fresnel Integrals into 3 cases: a truncated Taylor series, modified trapezoid rule and an asymptotic expansion for small, medium and large arguments respectively. These special functions can be computed accurately and efficiently up to an arbitrary precision. Error estimates are provided and we give a systematic method in choosing the various parameters for a desired precision. We illustrate this method and verify numerically using double precision.
Key words and phrases:
Fresnel Integrals and Asymptotic expansion and Numerical analysis and Numerical quadrature1. Introduction
The Fresnel integrals and their simultaneous parametric plot, the clothoid, have numerous applications including; but not limited to, optics and electromagnetic theory [8, 15, 16, 17, 21], robotics [2, 7, 12, 13, 14], civil engineering [4, 9, 20] and biology [18]. There have been numerous works over the past 70 years computing and numerically approximating Fresnel integrals. Boersma established approximations using the Lanczos tau-method [3] and Cody computed rational Chebyshev approximations using the Remes algorithm [5]. Another approach includes a spreadsheet computation by Mielenz [10]; which is based on successive improvements of known relational approximations. Mielenz also gives an improvement of his work [11], where the accuracy is less then -. More recently, Alazah, Chandler-Wilde and LaPorte propose a method to compute these integrals via a modified trapezoid rule [1].
Alazah et al. remark after some experimentation that a truncation of the Taylor series is more efficient and accurate than their new method for a small argument [1]. We build on this philosophy and add to it by endorsing asymptotic expansion for large arguments (see [10] for an earlier example). We propose a technique combining truncated Taylor series, the modified trapezium rule and asymptotic expansion and test its validity for practical computation of the Fresnel integrals all over the real line. Cut-off points are found analytically yielding a technique valid for arbitrary precision.
The paper is organized as follows: Section 2 gives a brief introduction to Fresnel integrals. In Section 3 the approximations with appropriate bounds are introduced. Section 4 contains a systematic method for choosing the parameters to construct an approximation using results from Section 3. Section 5 contains some benchmarking and comparative results. Lastly, conclusions are provided in Section 6.
2. Fresnel Integrals
We define the Fresnel cosine and sine integrals, and respectively, as follows:
(1) |
This is consistent with [1]. With this pair of integrals, and can be written as a complex exponential integral:
(2) |
The Argand diagram of for real plots the clothoid. Also, both and are odd functions of and can be extended to analytic functions over the complex plane. can also be expressed as
(3) |
with being the error function.
3. Approximations and Error bounds
In this section we list the approximations to be used for along with their corresponding error bounds. We start with the truncated Taylor series ;
(4) |
is an alternating series in both real and imaginary parts bounding these by the next term, we have the estimate
(5) |
Modified trapezoid sum from [1], which is
(6) | ||||
(7) |
where is defined in (9). A global bound for eq. (6), see eq. (67) from [1], is
(8) |
Where is given as eq. (47) in [1]; which is
and , are the constants
(9) |
The asymptotic expansion can be derived directly as follows, first write
Applying repeated applications of integration by parts gives
(10) |
with
(11) |
For the error bound, estimating the integral in (10) gives,
(12) |
The expansion in eq. (11) is connected to the generalized hypergeometric series . The bound in eq. (12) is a much sharper then directly estimating the remainder term of the hypergeometric series, see 13.7.5 from NIST [6].
4. Technique
We start this section by making some observations. The Taylor expansion is accurate near zero. As becomes increasingly large, more terms are needed to maintain accuracy. On the other hand, the asymptotic expansion is accurate for large and as become small it needs more terms to maintain accuracy. The modified trapezoid rule does have a global bound; see [1], but in general is more prone to round-off errors for too small or too large. Given the parity of the Fresnel integrals, we consider positive and split the non-negative reals into 3 sub-intervals with cut-off points and . Orders of approximation are also selected for the Taylor polynomial, , the modified trapezoid rule, , and the asymptotic expansion, , respectively. We give a methodical approach to choosing the parameters , , and we select these parameters for double precision. In doing so we balance the float point operations between the 3 approximations and maintain the accuracy of the approximation. This provides and accurate approximation, near the desired machine precision with no increase in computational time for any . We remark that if one would like another precision, the parameters can be refined in the same manner as done below.
We start with equation (8), which is a global bound for the modified trapezoid rule. Choosing the parameter gives - which is below double precision. Choosing the value gives - which is slightly above double precision, for this example we will choose . As per the above discussion, for a given , proves to be a better approximation for small , while is a better approximation for large . We thus choose and based on the computational time. Doing so gives , . In deciding the orders , we can now choose and based off the precision we want. Considering eq. (5) at gives -. Also, considering eq. (12) at gives -.
In summary, we have the approximation
(13) |
Using the the parity of the estimate holds for all . So we achieve a double precision approximation that has similar computational time for all while avoiding machine rounding errors.
5. Numerical Experiments
Alazah et al. (see [1]) test the validity of their method for arguments between 0 and 1000 and endorse the truncated Taylor series for small arguments, a well known approach. Many other methods present in literature use polynomial or rational approximations, splitting the domain into several regions. As far as we know, the most accurate one is Cody [5] with relative errors . However the form for the intermediate region and cut-off points are found experimentally. Mielenz [10] uses an asymptotic expansion for large arguments equivalent to a particular case of the form we use fixing . We confirm the precision of our technique here and test its efficiency.
Numerical experiments were run with MatLab ver. R2020a using a 5th generation Intel i7-5500U CPU @ 2.4GHz, with 16GB of PC3L-12800 DDR3L ram. We compare our approximation against two sources. First the native Frensel cosine and sine functions for MatLab, we denote this by = fresnelcfresnels with the fresnelc and fresnels cosine and sine functions. We compare with an approximation based off Mielenz [10], which uses a spline interpolant. This will be denoted as and can be found in the MatLab file exchange111John D’Errico (2020). FresnelS and FresnelC
(https://www.mathworks.com/matlabcentral/fileexchange/28765-fresnels-and-fresnelc),
MATLAB Central File Exchange..


Figure 1 shows the errors between the approximation , and . For each subinterval, partitioned by and , each approximation is evaluated at 1000 random points. The average of the errors is in Table 2. Although and are approximations themselves, there is consistent behavior between these approximations. The error reflects the accuracy of the approximation for a the given subinterval.
Approximation | |||
---|---|---|---|
Interval | |||
3.2951313293e-05 | 1.2483252225e-04 | 2.776233718e-02 | |
2.9528400045e-05 | 8.6929393952e-05 | 2.874295949e-02 | |
3.2216610024e-05 | 4.2383601564e-05 | 2.809127640e-02 |
Average point-wise error | ||
---|---|---|
Interval | ||
4.3744537030e-17 | 6.1597220741e-16 | |
1.4010574651e-16 | 2.1708872956e-15 | |
4.0216009902e-16 | 6.8351638744e-16 |


Figure 2 shows a comparison for large , we use 2000 random test points between the interval . We show a comparison between the errors generated by the native functions in MatLab, and the asymptotic expansion , the errors generated by and . This illustrates the limit of precision of the approximation . We note that and use the same asymptotic expansion for large , but their implementations are different. It should also be noted that both approximations and are fast to compute, the time can be seen in Table (1). If one were to need a quicker implementation, one could precompute the coefficients for given parameters .
6. Conclusion
In this work we have presented a systematic way to compute Fresnel integrals up to an arbitrary machine precision. Our numerical experiments verify this for double precision. If more accuracy is required, one can select the parameters in a similar fashion to what is done in Section 4. In Section 5 we are also able to justify the results from previous works where justification was heuristic. With a proper implementation, the method presented can improve the performance for computing Fresnel integrals in standard packages such as SciPy [19]. In computer aided geometric design, this technique can be used to plot clothoid segments for transition curves and clothoidal splines.
The underlying philosophy combining Taylor series, some clever form of quadrature and asymptotic expansion can be investigated for the computation of other special functions and more exotic curves arising in CAGD.
References
- [1] M. Alazah, S. N. Chandler-Wilde, and S. La Porte. Computing fresnel integrals via modified trapezium rules. Numerische Mathematik, 128(4):635–661, 2014.
- [2] P. Bevilacqua, M. Frego, E. Bertolazzi, D. Fontanelli, L. Palopoli, and F. Biral. Path planning maximising human comfort for assistive robots. In 2016 IEEE Conference on Control Applications (CCA), pages 1421–1427. IEEE, 2016.
- [3] J. Boersma. Computation of fresnel integrals. Mathematics of Computation, 14:380–380, 1960.
- [4] T. Butz, M. Ehmann, and T.-M. Wolter. A realistic road model for real-time vehicle dynamics simulation. Technical report, SAE Technical Paper, 2004.
- [5] W. Cody. Chebyshev approximations for the fresnel integrals. Mathematics of Computation, 22(102):450–453, 1968.
- [6] NIST Digital Library of Mathematical Functions. http://dlmf.nist.gov/, Release 1.0.28 of 2020-09-15. F. W. J. Olver, A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, B. V. Saunders, H. S. Cohl, and M. A. McClain, eds.
- [7] S. Fleury, P. Soueres, J.-P. Laumond, and R. Chatila. Primitives for smoothing mobile robot trajectories. IEEE transactions on robotics and automation, 11(3):441–448, 1995.
- [8] A. A. Goloborodko. Computer simulation of talbot phenomenon using the fresnel integrals approach. Optik, 127(10):4478–4482, 2016.
- [9] S.-D. Kim and H. J. Lee. The comparison of analytical and numerical solutions for wave diffraction due to insular breakwater. International Journal of Physical Sciences, 5(3):226–237, 2010.
- [10] K. D. Mielenz. Computation of fresnel integrals. Journal of research of the National Institute of Standards and Technology, 102(3):363, 1997.
- [11] K. D. Mielenz. Computation of fresnel integrals. ii. Journal of research of the National Institute of Standards and Technology, 105(4):589–590, 2000.
- [12] N. Montés, A. Herraez, L. Armesto, and J. Tornero. Real-time clothoid approximation by rational bezier curves. In 2008 IEEE International Conference on Robotics and Automation, pages 2246–2251. IEEE, 2008.
- [13] B. Nagy and A. Kelly. Trajectory generation for car-like robots using cubic curvature polynomials. Field and Service Robots, 11, 2001.
- [14] J. Reuter. Mobile robots trajectories with continuously differentiable curvature: an optimal control approach. In Proceedings. 1998 IEEE/RSJ International Conference on Intelligent Robots and Systems. Innovations in Theory, Practice and Applications (Cat. No. 98CH36190), volume 1, pages 38–43. IEEE, 1998.
- [15] M. Sandoval-Hernandez, H. Vazquez-Leal, L. Hernandez-Martinez, U. Filobello-Nino, V. Jimenez-Fernandez, A. Herrera-May, R. Castaneda-Sheissa, R. Ambrosio-Lazaro, and G. Diaz-Arango. Approximation of fresnel integrals with applications to diffraction problems. Mathematical Problems in Engineering, 2018, 2018.
- [16] L. Sangeorzan, M. Parpalea, A. Nedelcu, and C. Aldea. Some aspects in the modelling of physics phenomena using computer graphics. In Proceedings of the 10th WSEAS international conference on Mathematical and computational methods in science and engineering, pages 518–523. World Scientific and Engineering Academy and Society (WSEAS), 2008.
- [17] T. Shimobaba, T. Ito, N. Masuda, Y. Abe, Y. Ichihashi, H. Nakayama, N. Takada, A. Shiraki, and T. Sugie. Numerical calculation library for diffraction integrals using the graphic processing unit: the gpu-based wave optics library. Journal of Optics A: Pure and Applied Optics, 10(7):075308, 2008.
- [18] E. L. Starostin, R. A. Grant, G. Dougill, G. H. M. van der Heijden, and V. G. A. Goss. The euler spiral of rat whiskers. Science advances, 6(3):eaax5145, January 2020.
- [19] P. Virtanen, R. Gommers, T. E. Oliphant, M. Haberland, T. Reddy, D. Cournapeau, E. Burovski, P. Peterson, W. Weckesser, J. Bright, S. J. van der Walt, M. Brett, J. Wilson, K. J. Millman, N. Mayorov, A. R. J. Nelson, E. Jones, R. Kern, E. Larson, C. J. Carey, İ. Polat, Y. Feng, E. W. Moore, J. VanderPlas, D. Laxalde, J. Perktold, R. Cimrman, I. Henriksen, E. A. Quintero, C. R. Harris, A. M. Archibald, A. H. Ribeiro, F. Pedregosa, P. van Mulbregt, and SciPy 1.0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17:261–272, 2020.
- [20] L. Wang, K. T. Miura, E. Nakamae, T. Yamamoto, and T. J. Wang. An approximation approach of the clothoid curve defined in the interval [0, /2] and its offset by free-form curves. Computer-Aided Design, 33(14):1049–1058, 2001.
- [21] H. Zhang, Y. Zhao, L. Cao, and G. Jin. Layered holographic stereogram based on inverse fresnel diffraction. Applied optics, 55(3):A154–A159, 2016.