Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

numeric computing

by spurperl (Priest)
on Aug 04, 2003 at 04:56 UTC ( #280561=perlquestion: print w/ replies, xml ) Need Help??
spurperl has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks,

Is there any numeric computing package in Perl ? For example, solution of Linear equations using various methods (Gauss-Jordan, LTU, etc...), and/or root finding ?

All I found was Math::Matrix which is a base, but no real numeric tools ?

Perl may not be the best tool for numeric analysis work, but sometimes it's needed.

Comment on numeric computing
Re: numeric computing
by Zaxo (Archbishop) on Aug 04, 2003 at 05:05 UTC

    You're looking for PDL. Very fast and good.

    After Compline,
    Zaxo

Re: numeric computing
by wufnik (Friar) on Aug 04, 2003 at 07:30 UTC
    hola;

    PDL, above, is great, but lacks a number of LP specific thingies. chunlou suggested the Math::LP at Re: Re: Minimax / AlphaBeta harness, which i think works on unix, tho i had problems getting it to compile. it harnesses one of the faster LP engines.

    there is also the gnu linear programming toolkit, sadly yet to find a perl harness. this also solves constraint satistaction probs like n-queens, and other prob. categories. links to that and other potentially useful LP engines are in the above thread.

    best of luck,

    wufnik

    -- in the world of the mules there are no rules --
Re: numeric computing
by chunlou (Curate) on Aug 04, 2003 at 16:34 UTC

    It happens that there's Statistics::LTU. In general, look for the solution that lets Perl interface with other external software.

    Inline::Octave may be useful.

    Pari (a number theory package) may also be of use.

    Omegahat has a bunch of bi-directional interfaces for general programming languages and math software.

    Math::MatrixReal can solve linear equations alright. It can't deal with eigensystem in general, only the symmetric case. But it's not hard to implement your own power method to find real (as opposed to complex) eigen values.

    use constant eps => 0.00001; my $m; sub eigen { $m = shift; # assume a Math::MatrixReal object return _eigen(-1e300, $m->column(1)->each(sub{1})); } sub _eigen { my $v = $_[1]; $v = $m*$v; my $eigen = $v->norm_max(); $v = $v*(1/$eigen); abs($eigen - $_[0]) > eps ? _eigen($eigen,$v) : return($eigen,$v); }


    __________________
    Caveat. Power method may go on forever if no real eigenvalues exist unless you explicitly limit the number of iteration.

Re: numeric computing
by jmanning2k (Pilgrim) on Aug 04, 2003 at 18:35 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://280561]
Approved by vek
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-12-18 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls