Package org.apache.commons.math.special
Class Erf
- java.lang.Object
-
- org.apache.commons.math.special.Erf
-
public class Erf extends java.lang.Object
This is a utility class that provides computation methods related to the error functions.- Version:
- $Revision: 1054186 $ $Date: 2011-01-01 03:28:46 +0100 (sam. 01 janv. 2011) $
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
erf(double x)
Returns the error functionstatic double
erfc(double x)
Returns the complementary error function
-
-
-
Method Detail
-
erf
public static double erf(double x) throws MathException
Returns the error function
erf(x) = 2/√π 0∫x e-t2dt
This implementation computes erf(x) using the
regularized gamma function
, following Erf, equation (3)The value returned is always between -1 and 1 (inclusive). If
abs(x) > 40
, thenerf(x)
is indistinguishable from either 1 or -1 as a double, so the appropriate extreme value is returned.- Parameters:
x
- the value.- Returns:
- the error function erf(x)
- Throws:
MathException
- if the algorithm fails to converge.- See Also:
Gamma.regularizedGammaP(double, double, double, int)
-
erfc
public static double erfc(double x) throws MathException
Returns the complementary error function
erfc(x) = 2/√π x∫∞ e-t2dt
= 1 -erf(x)
This implementation computes erfc(x) using the
regularized gamma function
, following Erf, equation (3).The value returned is always between 0 and 2 (inclusive). If
abs(x) > 40
, thenerf(x)
is indistinguishable from either 0 or 2 as a double, so the appropriate extreme value is returned.- Parameters:
x
- the value- Returns:
- the complementary error function erfc(x)
- Throws:
MathException
- if the algorithm fails to converge- Since:
- 2.2
- See Also:
Gamma.regularizedGammaQ(double, double, double, int)
-
-