Skip to main content
`Ctrl`+`K`

# scipy.special.fresnel

scipy.special.fresnel(z, out=None) = <ufunc 'fresnel'>

  Fresnel integrals.

  The Fresnel integrals are defined as

  \[\begin{split}S(z) &= \int_0^z \sin(\pi t^2 /2) dt, \\ C(z) &= \int_0^z \cos(\pi t^2 /2) dt.\end{split}\]

  See [dlmf] for details.

  Parameters:
    z array_like

      Real or complex valued argument

    out 2-tuple of ndarrays, optional

      Optional output arrays for the function results

  Returns:
    S, C 2-tuple of scalar or ndarray

      Values of the Fresnel integrals

  See also

  `fresnel_zeros`

    zeros of the Fresnel integrals

  References

  [dlmf]

  NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/7.2#iii

  Examples

      >>> import numpy as np
      >>> from scipy.special import fresnel, erf

  First, we verify the following limits:

  \[\lim_{z \to \infty} S(z) = \lim_{z \to \infty} C(z) = 1/2.\]

      >>> S, C = fresnel([0.1, 1, 10, 100, np.inf])
      >>> S
      array([0.00052359, 0.43825915, 0.46816998, 0.4968169 , 0.5       ])
      >>> C
      array([0.09999753, 0.7798934 , 0.49989869, 0.4999999 , 0.5       ])

  Next, we verify the following relation to the error function:

  \[C(z) + i S(z) = \frac{1 + i}{2} \operatorname{erf}\left(\frac{\sqrt{\pi}(1 - i)}{2} z\right).\]

      >>> z = np.linspace(-10, 10)
      >>> S, C = fresnel(z)
      >>> RHS = (1 + 1j)/2 * erf((np.sqrt(np.pi)*(1 - 1j))/2*z)
      >>> np.allclose(C + 1j*S, RHS)
      True

  Finally, we plot \(C(z)\) against \(S(z)\) to get the Euler or Cornu spiral.

      >>> import matplotlib.pyplot as plt
      >>> z = np.linspace(-10, 10, num=1000)
      >>> S, C = fresnel(z)
      >>> fig, ax = plt.subplots()
      >>> ax.plot(C, S)
      >>> ax.set_aspect('equal')
      >>> ax.set_xlabel('$C(z)$')
      >>> ax.set_ylabel('$S(z)$')
      >>> plt.show()