Difference between revisions of "ApCoCoA-1:Num.EigenValuesAndAllVectors"

From ApCoCoAWiki
Line 1: Line 1:
 
   <command>
 
   <command>
     <title>Numerical.EigenValuesAndAllVectors</title>
+
     <title>Num.EigenValuesAndAllVectors</title>
     <short_description>eigenvalues and left and right eigenvectors of a matrix</short_description>
+
     <short_description>Computes eigenvalues and left and right eigenvectors of a matrix</short_description>
 
<syntax>
 
<syntax>
$numerical.EigenValuesAndAllVectors(A:Matrix):List
+
Num.EigenValuesAndAllVectors(A:Matrix):[B:Matrix, C:Matrix, D:Matrix, E:Matrix, F:Matrix]
 
</syntax>
 
</syntax>
 
     <description>
 
     <description>
 
{{ApCoCoAServer}} Please also note that you will have to use an ApCoCoAServer with enabled BLAS/LAPACK support.
 
{{ApCoCoAServer}} Please also note that you will have to use an ApCoCoAServer with enabled BLAS/LAPACK support.
  
This function returns a List of three matrices, containing numerical approximation to A's eigenvalues and right and left eigenvectors.  
+
This function returns a List of five matrices, containing numerical approximation to A's eigenvalues and right and left eigenvectors.  
Therefore the input matrix A has to be rectangular!
+
The input matrix A has to be a square matrix!
It is implemented in the ApCoCoA server, so you need a running server. It was not implemented in version 0.99.4 or previous. Also please keep in mind this method is based on blas/Lapack's eigenvalue solver and uses floating point arithmetic. This is not an exact, algebraic method!
+
The output [B:Matrix, C:Matrix, D:Matrix, E:Matrix, F:Matrix] contains a matrix B, where each column contains one of A's eigenvalues. The first row contains the eigenvalue's real part, the second row the imaginary.
The output list contains first a matrix B. Each row of B describe one of A's eigenvalues. The first column contains the eigenvalue's real part, the second the imaginary.
+
The matrices C, D, E and F all have the same dimensions as A. Column j of matrix C contains the real part of the right eigenvector corresponding to eigenvalue j and column j of matrix D contains the imaginary part of the right eigenvector correspsonding to eigenvalue j. The matrices E and F store the left eigenvectors in the same way as C and D.
The second element of the list is a matrix of the size of A, containing A's left hand eigenvectors, while the third element in the list is a matrix containing the right hand eigenvectors. Column j contains the eigenvector corresponding to eigenvalue j if the imaginary part of j is zero. If eigenvalue  j had also an imaginary part, then eigenvalue j+1 is the complex conjugate of j and the eigenvector of j is composed of the real part stored in column j and the imaginary part stored in column j+1. The eigenvector of j+1 is the complex conjugate of eigenvector j.
 
 
<example>
 
<example>
 
A:=Mat([[1,2,7,18],[2,4,9,12],[23,8,9,10],[7,5,3,2]]);  
 
A:=Mat([[1,2,7,18],[2,4,9,12],[23,8,9,10],[7,5,3,2]]);  
Numerical.EigenValuesAndAllVectors(A);
+
Dec(Num.EigenValuesAndAllVectors(A),3);
-- CoCoAServer: computing Cpu Time = 0.0031
+
-- CoCoAServer: computing Cpu Time = 0.016
 
-------------------------------
 
-------------------------------
 
[Mat([
 
[Mat([
   [4077234895954899/140737488355328, -3850002255576291/281474976710656, 3186113456591853/9007199254740992, 3186113456591853/9007199254740992],
+
   ["28.970", "-13.677", "0.353", "0.353"],
   [0, 0, 6871934657603045/2251799813685248, -6871934657603045/2251799813685248]
+
   ["0", "0", "3.051", "-3.051"]
 
]), Mat([
 
]), Mat([
   [1211656389006889/2251799813685248, 5405727161387211/9007199254740992, 1571393504747479/9007199254740992, -7024364631742825/18014398509481984],
+
   ["0.538", "-0.600", "0.389", "0.389"],
   [350694995566991/1125899906842624, 4012694633891333/18014398509481984, -5041294450411215/36028797018963968, 7963794620848619/18014398509481984],
+
   ["0.311", "-0.222", "-0.442", "-0.442"],
   [7702243945405117/18014398509481984, -6293666352540407/36028797018963968, -4789736757058405/18014398509481984, -3648514314569325/72057594037927936],
+
   ["0.427", "0.174", "0.050", "0.050"],
   [5910799605047357/9007199254740992, -6738448111784603/9007199254740992, 3276340384567917/4503599627370496, 0]
+
   ["0.656", "0.748", "0", "0"]
 
]), Mat([
 
]), Mat([
   [1777559794020963/4503599627370496, 5241040126502889/9007199254740992, -4553859282588877/144115188075855872, 4695168387448585/18014398509481984],
+
   ["0", "0", "-0.174", "0.174"],
   [7846388397589841/18014398509481984, 3981313256671163/9007199254740992, -5438845171485265/18014398509481984, -4930385173711607/9007199254740992],
+
   ["0", "0", "0.139", "-0.139"],
   [6875189208942329/9007199254740992, -5600762787593733/9007199254740992, 11970674168303/17592186044416, 0],
+
  ["0", "0", "0.265", "-0.265"],
   [2414763704612135/9007199254740992, -5076115741924331/18014398509481984, -2469130937097749/9007199254740992, 3322230315885151/72057594037927936]
+
  ["0", "0", "-0.727", "0.727"]
 +
]), Mat([
 +
   ["0.394", "-0.581", "0.260", "0.260"],
 +
   ["0.435", "-0.442", "-0.547", "-0.547"],
 +
  ["0.763", "0.621", "0", "0"],
 +
  ["0.268", "0.281", "0.046", "0.046"]
 +
]), Mat([
 +
  ["0", "0", "-0.031", "0.031"],
 +
  ["0", "0", "-0.301", "0.301"],
 +
  ["0", "0", "0.680", "-0.680"],
 +
  ["0", "0", "-0.274", "0.274"]
 
])]
 
])]
 
-------------------------------
 
-------------------------------
Line 45: Line 54:
 
       <type>cocoaserver</type>
 
       <type>cocoaserver</type>
 
     </types>
 
     </types>
     <key>heldt</key>
+
     <key>Num.EigenValuesAndAllVectors</key>
     <key>numerical.eigenvaluesandallvectors</key>
+
     <key>EigenValuesAndAllVectors</key>
 
     <wiki-category>Package_Numerical</wiki-category>
 
     <wiki-category>Package_Numerical</wiki-category>
 
   </command>
 
   </command>

Revision as of 13:54, 30 March 2009

Num.EigenValuesAndAllVectors

Computes eigenvalues and left and right eigenvectors of a matrix

Syntax

Num.EigenValuesAndAllVectors(A:Matrix):[B:Matrix, C:Matrix, D:Matrix, E:Matrix, F:Matrix]

Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use

it/them. Please also note that you will have to use an ApCoCoAServer with enabled BLAS/LAPACK support.

This function returns a List of five matrices, containing numerical approximation to A's eigenvalues and right and left eigenvectors.

The input matrix A has to be a square matrix!

The output [B:Matrix, C:Matrix, D:Matrix, E:Matrix, F:Matrix] contains a matrix B, where each column contains one of A's eigenvalues. The first row contains the eigenvalue's real part, the second row the imaginary. The matrices C, D, E and F all have the same dimensions as A. Column j of matrix C contains the real part of the right eigenvector corresponding to eigenvalue j and column j of matrix D contains the imaginary part of the right eigenvector correspsonding to eigenvalue j. The matrices E and F store the left eigenvectors in the same way as C and D.

Example

A:=Mat([[1,2,7,18],[2,4,9,12],[23,8,9,10],[7,5,3,2]]); 
Dec(Num.EigenValuesAndAllVectors(A),3);
-- CoCoAServer: computing Cpu Time = 0.016
-------------------------------
[Mat([
  ["28.970", "-13.677", "0.353", "0.353"],
  ["0", "0", "3.051", "-3.051"]
]), Mat([
  ["0.538", "-0.600", "0.389", "0.389"],
  ["0.311", "-0.222", "-0.442", "-0.442"],
  ["0.427", "0.174", "0.050", "0.050"],
  ["0.656", "0.748", "0", "0"]
]), Mat([
  ["0", "0", "-0.174", "0.174"],
  ["0", "0", "0.139", "-0.139"],
  ["0", "0", "0.265", "-0.265"],
  ["0", "0", "-0.727", "0.727"]
]), Mat([
  ["0.394", "-0.581", "0.260", "0.260"],
  ["0.435", "-0.442", "-0.547", "-0.547"],
  ["0.763", "0.621", "0", "0"],
  ["0.268", "0.281", "0.046", "0.046"]
]), Mat([
  ["0", "0", "-0.031", "0.031"],
  ["0", "0", "-0.301", "0.301"],
  ["0", "0", "0.680", "-0.680"],
  ["0", "0", "-0.274", "0.274"]
])]
-------------------------------

See also

Introduction to CoCoAServer

Numerical.QR

Numerical.SVD

Numerical.EigenValues

Numerical.EigenValuesAndVectors