Prev Next

The AD Error Function

Syntax
y = erf(x)

Description
Returns the value of the error function which is defined by  \[
{\rm erf} (x) = \frac{2}{ \sqrt{\pi} } \int_0^x \exp( - t * t ) \; {\bf d} t
\] 


x
The argument x , and the result y have one of the following paris of prototypes:
     const float
                  &x,     float    y
     const double
                 &x,     double   y
     const AD<
Base>               &x,     AD<Basey
     const VecAD<
Base>::reference &x,     AD<Basey

Operation Sequence
The AD of Base operation sequence used to calculate y is independent of x .

Method
This is a fast approximation (few numerical operations) with relative error bound  4 \times 10^{-4} ; see Vedder, J.D., Simple approximations for the error function and its inverse, American Journal of Physics, v 55, n 8, 1987, p 762-3.

Example
The file Erf.cpp contains an example and test of this function. It returns true if it succeeds and false otherwise.
Input File: cppad/local/erf.hpp