linearalgebra: December 2008 Archives

Matrix Eigenvalues in Perl Don't Get Much Easier

| | Comments (0) | TrackBacks (0)
The Matrix subsystem has really grown up in the last few days since the 0.16 release, including easy-to-use methods to calculate Matrix eigenvalues. All kinds of other methods are now available, like
my $det1 = $A->det;      # determinant
my $det2 = abs $A;       # determinant

my $inv = $A->inverse;  
my @eigs = $A->eigenvalues;

my ($eigenvalues, $eigenvectors) = $matrix->eigenpair;
my ($eig1,$eig2) = @$eigenvalues;
my ($u,$v)       = @$eigenvectors;
Compare this new script for calculating eigenvalues and eigenvectors of a nonsymmetric matrix to the old version. Yes, quite an improvement and quite pleasing to the eye now. Note that $A->eigenvalues; returns a list of Math::Complex objects because in general the eigenvalues of a real matrix can be complex. Only if your matrix is symmetric are you guaranteed real eigenvalues.

About this Archive

This page is a archive of entries in the linearalgebra category from December 2008.

linearalgebra: November 2008 is the previous archive.

Find recent content on the main index or look in the archives to find all content.

Screw you, spammers! Clicky Web Analytics