! Compute eigenvalues and eigenvectors; ! Keywords: Eigenvalue, Eigenvector, Matt Damon, PCA, Population growth,
Principal Component Analysis, Good Will Hunting;
SETS:
item: evalr, evali;
ixi( item, item): a, evecr, eveci;
ENDSETS
DATA:
! Case: Finding the eigenvalues of these two matrices was
listed as an exercise on the board to be solved by
Matt Damon in the movie "Good Will Hunting";
! item = 1..3;
! A =
1 1 0
1 1 -2
2 1 0;
! A =
2 -1 -1
-1 2 -1
-1 -1 2;
! A Covariance matrix;
! item = ATT GMC USX;
! A =
.01080754 .01240721 .01307513
.01240721 .05839170 .05542639
.01307513 .05542639 .09422681;
! A population change matrix;
item = Bunnies Clover Foxes;
A =
0.612 2.291 -1.200
-0.295 2.321 -0.560
0.500 -0.050 0.110 ;
ENDDATA
CALC:
! Get the eigenvalues(real part),
eigenvectors(real part), eigenvalues(imaginary part),
and eigenvectors(imaginary part);
evalr, evecr, evali, eveci = @eigen(a);
ENDCALC
DATA:
@TEXT() = '';
@TEXT() = 'eigenvalues, real part:';
@TEXT() = @table( evalr);
@TEXT() = '';
@TEXT() = 'eigenvectors(columns), real part:';
@TEXT() = @table( evecr);
@TEXT() = '';
@TEXT() = 'eigenvalues, imaginary part:';
@TEXT() = @table( evali);
@TEXT() = '';
@TEXT() = 'eigenvectors(columns), imaginary part:';
@TEXT() = @table( eveci);
ENDDATA
|