Difference between revisions of "ApCoCoA-1:Num.EigenValuesAndVectors"
(Updated the Doku) |
|||
Line 3: | Line 3: | ||
<short_description>Computes the eigenvalues and eigenvectors of a matrix</short_description> | <short_description>Computes the eigenvalues and eigenvectors of a matrix</short_description> | ||
<syntax> | <syntax> | ||
− | + | Num.EigenValuesAndVectors(A:Matrix):[B:Matrix, C:Matrix, D: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 | + | This function returns a list of three matrices, containing numerical approximation to A's eigenvalues and (right hand) eigenvectors. |
− | + | The input matrix A has to be a square matrix! | |
− | + | The output [B:Matrix, C:Matrix, D: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 contains | + | The matrices C and B have both the same dimensions as A. Column j of matrix C contains the real part of the eigenvector corresponding to eigenvalue j and column j of matrix D contains the imaginary part of the eigenvector correspsonding to eigenvalue j. |
− | The | ||
To compute only the left hand's eigenvectors apply this method to Transposed(A). | To compute only the left hand's eigenvectors apply this method to Transposed(A). | ||
<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]]); | ||
− | + | Dec(Num.EigenValuesAndVectors(A),3); | |
− | -- CoCoAServer: computing Cpu Time = 0. | + | |
+ | -- CoCoAServer: computing Cpu Time = 0.016 | ||
------------------------------- | ------------------------------- | ||
[Mat([ | [Mat([ | ||
− | [ | + | ["28.970", "-13.677", "0.353", "0.353"], |
− | [0, 0, | + | ["0", "0", "3.051", "-3.051"] |
]), Mat([ | ]), 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"] | ||
])] | ])] | ||
− | ------------------------------- | + | -------------------------------------------------------------- |
</example> | </example> | ||
</description> | </description> | ||
Line 41: | Line 46: | ||
<type>cocoaserver</type> | <type>cocoaserver</type> | ||
</types> | </types> | ||
− | <key> | + | <key>Num.EigenValuesAndVectors</key> |
− | <key> | + | <key>EigenValuesAndVectors</key> |
<wiki-category>Package_Numerical</wiki-category> | <wiki-category>Package_Numerical</wiki-category> | ||
</command> | </command> |
Revision as of 13:33, 30 March 2009
Numerical.EigenValuesAndVectors
Computes the eigenvalues and eigenvectors of a matrix
Syntax
Num.EigenValuesAndVectors(A:Matrix):[B:Matrix, C:Matrix, D: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 three matrices, containing numerical approximation to A's eigenvalues and (right hand) eigenvectors.
The input matrix A has to be a square matrix!
The output [B:Matrix, C:Matrix, D: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 and B have both the same dimensions as A. Column j of matrix C contains the real part of the eigenvector corresponding to eigenvalue j and column j of matrix D contains the imaginary part of the eigenvector correspsonding to eigenvalue j. To compute only the left hand's eigenvectors apply this method to Transposed(A).
Example
A:=Mat([[1,2,7,18],[2,4,9,12],[23,8,9,10],[7,5,3,2]]); Dec(Num.EigenValuesAndVectors(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.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
Numerical.EigenValuesAndAllVectors