FUNCTION
errorFn
Interface
#include <codecogs/maths/special/errorfn.h>
using namespace Maths::Special;
The Error Function is defined by equation
$$erf(x) \equiv \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt$$
(1)
and has the shape \graph x=-4:4
References
- Eric W. Weisstein. "Erf." From MathWorld--A Wolfram Web Resource
- http://mathworld.wolfram.com/Erf.html
- Stephen L. Moshier, Cephes Mathematical Library (the rational
approximations used here for |x|>=1, split at |x|=8, are Moshier's).
Example 1
#include <codecogs/maths/special/errorfn.h>
#include <stdio.h>
using namespace Maths::Special;
int main( )
{
double x = 0.5;
printf("\n errorFn(%f) = %f", x, errorFn(x));
return getchar();
}Output:
errorFn(0.500000) = 0.520500Parameters
x
the upper limit of the integral
Returns
the value of the Error Function evaluated at the given abscissa, accurate to full double precision for any finite x (for |x| beyond about 6 the true value is indistinguishable from $\pm 1$ at double precision, and this returns exactly that)
Interactive Calculator
x
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.