Error Function - Implementations

Implementations

  • C: C99 provides the functions double erf(double x) and double erfc(double x) in the header math.h. The pairs of functions {erff,erfcf} and {erfl,erfcl} take and return values of type float and long double respectively.
  • C++: C++11 provides erf and erfc in the header cmath. Both functions are overloaded to accept arguments of type float, double, and long double. The various error functions for complex arguments are available as the free/open-source Faddeeva package.
  • Fortran: The Fortran 2008 standard provides the ERF, ERFC and ERFC_SCALED functions to calculate the error function and its complement for real arguments. Fortran 77 implementations are available in SLATEC.
  • Perl: erf (for real arguments, using Cody's algorithm) is implemented in the Perl module Math::SpecFun
  • Python: Included since version 2.7 as math.erf for real arguments. For previous versions or for complex arguments, an implementation of erf for complex arguments is in SciPy as scipy.special.erf. A complex-argument version is also in the arbitrary-precision arithmetic mpmath library as mpmath.erf
  • Mathematica: erf is implemented as Erf and Erfc in Mathematica for real and complex arguments, which are also available in Wolfram Alpha.
  • Haskell (programming language): An erf package exists that provides a typeclass for the error function and implementations for the native (real) floating point types.
  • R: "The so-called 'error function'" is not provided directly, but is detailed as an example of the normal cumulative distribution function (?pnorm), which is based on W. J. Cody's rational Chebyshev approximation algorithm.
  • MathCAD provides both erf(x) and erfc(x) for real arguments.
  • Matlab provides both erf and erfc for real arguments, also via W. J. Cody's algorithm.
  • Ruby: Provides Math.erf and Math.erfc for real arguments.
  • Java: Apache commons-math provides implementations of erf and erfc for real arguments.
  • Google search: Google's search also acts as a calculator and will evaluate "erf(...)" and "erfc(...)" for real arguments.

Read more about this topic:  Error Function