Error Functions

This module provides symbolic error functions. These functions use the \(mpmath library\) for numerical evaluation and Maxima, Pynac for symbolics.

The main objects which are exported from this module are:

  • erf – The error function
  • erfc – The complementary error function
  • erfi – The imaginary error function
  • erfinv – The inverse error function

AUTHORS:

  • Original authors erf/error_fcn (c) 2006-2014: Karl-Dieter Crisman, Benjamin Jones, Mike Hansen, William Stein, Burcin Erocal, Jeroen Demeyer, W. D. Joyner, R. Andrew Ohana
  • Reorganisation in new file, addition of erfi/erfinv/erfc (c) 2016: Ralf Stephan

REFERENCES:

class sage.functions.error.Function_erf

Bases: sage.symbolic.function.BuiltinFunction

The error function.

The error function is defined for real values as

\[\operatorname{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt.\]

This function is also defined for complex values, via analytic continuation.

EXAMPLES:

We can evaluate numerically:

sage: erf(2)
erf(2)
sage: erf(2).n()
0.995322265018953
sage: erf(2).n(100)
0.99532226501895273416206925637
sage: erf(ComplexField(100)(2+3j))
-20.829461427614568389103088452 + 8.6873182714701631444280787545*I

Basic symbolic properties are handled by Sage and Maxima:

sage: x = var("x")
sage: diff(erf(x),x)
2*e^(-x^2)/sqrt(pi)
sage: integrate(erf(x),x)
x*erf(x) + e^(-x^2)/sqrt(pi)

ALGORITHM:

Sage implements numerical evaluation of the error function via the erf() function from mpmath. Symbolics are handled by Sage and Maxima.

REFERENCES:

class sage.functions.error.Function_erfc

Bases: sage.symbolic.function.BuiltinFunction

The complementary error function.

The complementary error function is defined by

\[\frac{2}{\sqrt{\pi}} \int_t^\infty e^{-x^2} dx.\]

EXAMPLES:

sage: erfc(6)
erfc(6)
sage: erfc(6).n()
2.15197367124989e-17
sage: erfc(RealField(100)(1/2))
0.47950012218695346231725334611

sage: 1 - erfc(0.5)
0.520499877813047
sage: erf(0.5)
0.520499877813047
class sage.functions.error.Function_erfi

Bases: sage.symbolic.function.BuiltinFunction

The imaginary error function.

The imaginary error function is defined by

\[\operatorname{erfi}(x) = -i \operatorname{erf}(ix).\]
class sage.functions.error.Function_erfinv

Bases: sage.symbolic.function.BuiltinFunction

The inverse error function.

The inverse error function is defined by:

\[\operatorname{erfinv}(x) = \operatorname{erf}^{-1}(x).\]