| Games-Go-GoPair documentation | view source | Contained in the Games-Go-GoPair distribution. |
Games::Go::Erf - error and scaled and unscaled complementary error functions and their inverses
use Games::Go::Erf qw(erf erfc erfcx erfinv erfcinv erfcxinv);
Imports all the routines explicitly. Use a subset of the list for the routines you want.
use Games::Go::Erf qw(:all);
Imports all the routines, as well.
This module implements the error function, erf, and its inverse
erfinv, the complementary error function, erfc, and its inverse
erfcinv, and the scaled complementary error function, erfcx, and its
inverse erfcxinv.
For references and details about the algorithms, see the comments inside this module.
Returns the error function evaluated at EXPR. If EXPR is omitted, $_ is
used. The error function is
erf(x) = 2/sqrt(PI) * integral from 0 to x of exp(-t*t) dt
Returns the inverse of the error function evaluated at EXPR. If EXPR is
omitted, $_ is used.
Returns the complementary error function evaluated at EXPR. If EXPR is
omitted, $_ is used. The complementary error function is
erfc(x) = 2/sqrt(PI) * integral from x to infinity of exp(-t*t) dt
= 1 - erf(x)
Here is a function returning the lower tail probability of the standard normal distribution function
use Games::Go::Erf qw(erfc);
sub ltpnorm ($) {
erfc( - $_[0] / sqrt(2) )/2;
}
Returns the inverse complementary error function evaluated at EXPR. If EXPR
is omitted, $_ is used.
Here is a function returning the lower tail quantile of the standard normal distribution function
use Games::Go::Erf qw(erfcinv);
sub ltqnorm ($) {
-sqrt(2) * erfcinv( 2 * $_[0] );
}
Returns the scaled complementary error function evaluated at EXPR. If EXPR
is omitted, $_ is used. The scaled complementary error function is
erfcx(x) = exp(x*x) * erfc(x)
Returns the inverse scaled complementary error function evaluated at EXPR.
If EXPR is omitted, $_ is used.
Added the inverse functions.
Minor code tweaking.
First release.
Perl translation by Peter J. Acklam <pjacklam@online.no>
FORTRAN code by W. J. Cody, Argonne National Laboratory, March 19, 1990. FORTRAN code can be found at http://www.netlib.org/specfun/erf
Copyright (c) 1999-2000 Peter J. Acklam. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Games-Go-GoPair documentation | view source | Contained in the Games-Go-GoPair distribution. |