Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Fresnel Integrals

Synopsis
#include <boost/math/special_functions/fresnel.hpp>

namespace boost { namespace math {

template <class T>
calculated-result-type fresnel_c(T x);
template <class T, class Policy>
calculated-result-type fresnel_c(T x, const Policy&);

template <class T>
calculated-result-type fresnel_s(T x);
template <class T, class Policy>
calculated-result-type fresnel_s(T x, const Policy&);

// C(x) + i S(x):
template <class T>
complex-type fresnel_cis(T x);
template <class T, class Policy>
complex-type fresnel_cis(T x, const Policy&);

}} // namespaces
Description

The Fresnel integrals are

C(x) = ∫0x cos(πt2/2) dt, S(x) = ∫0x sin(πt2/2) dt

(DLMF 7.2.7, 7.2.8), the normalization of Abramowitz and Stegun, Mathematica, SciPy and mpmath, in which both tend to 1/2 as x → ∞. The curve (C(x), S(x)) is the Euler (Cornu) spiral. fresnel_cis returns C(x) + i S(x) = ∫0x cis(πt2/2) dt, cis = cos + i sin, for the cost of one of them: std::complex<calculated-result-type> for float, double and long double, and Boost.Multiprecision's matching complex type otherwise, whose header must then be included: cpp_complex_50 for cpp_bin_float_50, from <boost/multiprecision/cpp_complex.hpp> (likewise <boost/multiprecision/complex128.hpp>, <boost/multiprecision/mpc.hpp>).

double c = boost::math::fresnel_c(1.0);                // 0.779893400376822829...
std::complex<double> z = boost::math::fresnel_cis(1.0); // (0.779893400376822829..., 0.438259147390354766...)
Domain

All real x. Both functions are odd, and C(±∞) = S(±∞) = ±1/2 exactly. A NaN argument is a domain_error.

Accuracy

Relative errors in units of ε, against mpmath at 80 digits at the exact arguments, 20 000 points uniform on [0, 12] and log-uniform on [10-6, 109] (5 000 points for cpp_bin_float_50). By default float is evaluated in double; the second float row is evaluated in float (promote_float<false>).

Type

Series, πx2/2 ≤ p/10

Continued fraction

Asymptotic, x > ε-1/2

float

0.50

0.50

0.08

float, in float

0.50

0.75

0.50

double

0.50

0.69

0.50

cpp_bin_float_50

0.49

0.64

0.51

(p is the number of bits of the type; the series covers x ≤ 1.84 in double.) That is correctly rounded or nearly so everywhere; the largest errors, just above the switch to the continued fraction, are below one ulp.

Implementation

With θ = πx22 and /p bits of precision:

For types whose precision is set at run time, such as mpfr_float, everything that depends on the precision is recomputed at the current precision on each call.

References

PrevUpHomeNext