Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: numeric computing

by chunlou (Curate)
on Aug 04, 2003 at 16:34 UTC ( [id://280731]=note: print w/replies, xml ) Need Help??


in reply to numeric computing

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://280731]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found