The Error Function.

View versions (1)

Interface

#include <codecogs/maths/special/errorfn.h>

using namespace Maths::Special;

The Error Functionis defined by equation

erf(x) \equiv \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt
(1)

and has the shape \graph x=-2.9:2.9

This approximation of erf is only valid between -3 and 3

References

  • Eric W. Weisstein. "Erf." From MathWorld--A Wolfram Web Resource
  • http://mathworld.wolfram.com/Erf.html

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.520500

Parameters

x
the upper limit of the integral (-3<x<3)

Returns

the value of the Error Function evaluated at the given abscissa
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
Result