The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Go::Erf - error and scaled and unscaled complementary error functions and their inverses

SYNOPSIS

    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.

DESCRIPTION

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.

FUNCTIONS

erf EXPR
erf

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
erfinv EXPR
erfinv

Returns the inverse of the error function evaluated at EXPR. If EXPR is omitted, $_ is used.

erfc EXPR
erfc

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;
    }
erfcinv EXPR
erfcinv

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] );
    }
erfcx EXPR
erfcx

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)
erfcxinv EXPR
erfcxinv

Returns the inverse scaled complementary error function evaluated at EXPR. If EXPR is omitted, $_ is used.

HISTORY

Version 0.03

Added the inverse functions.

Version 0.02

Minor code tweaking.

Version 0.01

First release.

AUTHOR

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

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.