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

NAME

PerlGSL::Integration::SingleDim - A Perlish Interface to the GSL 1D Integration Library

SYNOPSIS

 use PerlGSL::Integration::SingleDim qw/int_1d/;
 my $result = int_1d(sub{ exp( -($_[0]**2) ) }, 0, 'Inf');

DESCRIPTION

This module is an interface to the GSL's Single Dimensional numerical integration routines.

FUNCTIONS

No functions are exported by default.

int_1d

This is the main interface provided by the module. It takes three required arguments and an (optional) options hash. The first argument is a subroutine reference defining the integrand. The next two are numbers defining the lower and upper bound of integration. The strings -Inf for a lower limit, and Inf for an upper limit are allowed as well (triggering the qagi-type engines).

The options hash reference accepts the following keys:

  • epsabs - The maximum allowable absolute error. The default is 0 (ignored).

  • epsrel - The maximum allowable relative error. The default is 1e-7.

  • calls - The number of points sampled in the function space. The default is 1000.

  • engine - This key is mostly for internal use, however if the value fast is given, the qng engine will be used if possible. Other values (the qag type engines) are determined internally as needed. The default is qag with a 21 point sample (this sampling setting is not configurable yet, but this is a reasonable choice).

In scalar context the result is returned, in list context the result and the standard deviation (error) are returned.

INSTALLATION REQUIREMENTS

This module needs the GSL library installed and available. The PERLGSL_LIBS environment variable may be used to pass the --libs linker flags; if this is not specified, the command gsl-config --libs is executed to find them. Future plans include using an Alien module to provide the GSL in a more CPAN-friendly manner.

SEE ALSO

SOURCE REPOSITORY

http://github.com/jberger/PerlGSL-Integration-SingleDim

AUTHOR

Joel Berger, <joel.a.berger@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Joel Berger

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The GSL is licensed under the terms of the GNU General Public License (GPL)