http://qs321.pair.com?node_id=109945

bladx has asked for the wisdom of the Perl Monks concerning the following question:

Are there other modules other than the basic MATH module(s) that contain libraries of common equations, as to alleviate writing out each individual equation?

Originally posted as a Categorized Question.

  • Comment on How can I import previously created math functions?

Replies are listed 'Best First'.
Re: How can I import previously created math functions?
by Zaxo (Archbishop) on Sep 04, 2001 at 04:52 UTC

    PDL is an extension which gives high speed matrix operations, and more. It has been used a lot for graphics and for scientific computing.

    Gsl is a yet-incomplete extension which uses the Gnu Scientific Library (GSL). It is a wip, only in version 0.03. So far it has bindings for calculating special functions. I was unable to install it due to hardcoded paths which disagreed with my gsl tree.

      PDL gained (some) GSL support with 2.003, in 1999. There is still only a subset of GSL with PDL bindings, but it is a large and useful subset.
Re: How can I import previously created math functions?
by ariels (Curate) on Sep 11, 2001 at 14:15 UTC
    The amazing Inline module offers help here, too. Not all <math.h> functions are available in Perl (even if you use POSIX;).

    Here's how to print some erf() values, for instance (a function almost certainly available in your maths library):

    perl -le 'use Inline C => q{ double erf(double); }, ENABLE => "AUTOWRA +P"; print "$_ ",erf($_) for (0..5)'

    You can of course write it into your modules, and use it to access you own libraries.

    Other C wrapping options are XS (of course) and Swig.

Re: How can I import previously created math functions?
by randyk (Parson) on Sep 20, 2005 at 17:57 UTC