Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| documentation:language_reference:objects:matrix:functions:eigensystem [2024/12/12 15:39] – Maurits W. Haverkort | documentation:language_reference:objects:matrix:functions:eigensystem [2025/05/06 14:11] (current) – Maurits W. Haverkort | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{indexmenu_n> | {{indexmenu_n> | ||
| - | ====== Eigensystem ====== | + | ====== |
| ### | ### | ||
| - | alligned paragraph text | + | Matrix.Eigensystem(M) calculates the eigenvalues and eigenvectors of the square matrix M. If M is Hermitian it returns the eigenvalues and a single eigenvector, |
| ### | ### | ||
| Line 9: | Line 9: | ||
| ### | ### | ||
| - | description text | + | For an Hermitian matrix |
| ### | ### | ||
| ==== Input ==== | ==== Input ==== | ||
| <code Quanty Example.Quanty> | <code Quanty Example.Quanty> | ||
| - | -- some example code | + | A = Matrix.New({{1, |
| + | {2,3,5}, | ||
| + | {3,5,1}}) | ||
| + | val, fun = Eigensystem(A) | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| </ | </ | ||
| ==== Result ==== | ==== Result ==== | ||
| <file Quanty_Output> | <file Quanty_Output> | ||
| - | text produced as output | + | The eigenvalues are |
| + | { -3.4339294734789 , -0.23514404390394 , 8.6690735173829 } | ||
| + | The eigenfunctions are | ||
| + | { { 0.3019 , 0.5247 , -0.796 | ||
| + | { 0.8587 , -0.5123 , -0.012 | ||
| + | { 0.4141 , 0.6799 , 0.6052 } } | ||
| + | |||
| + | The matrix transformed to a diagonal matrix by its eigenfunctions is | ||
| + | { { -3.4339 , 0 , 0 } , | ||
| + | { 0 , -0.2351 , 0 } , | ||
| + | { 0 , 0 , 8.6691 } } | ||
| </ | </ | ||
| + | |||
| + | |||
| + | ===== Example ===== | ||
| + | |||
| + | ### | ||
| + | For a non-Hermitian matrix | ||
| + | ### | ||
| + | |||
| + | ==== Input ==== | ||
| + | <code Quanty Example.Quanty> | ||
| + | A = Matrix.New({{1, | ||
| + | {5,3,7}, | ||
| + | {3,5,1}}) | ||
| + | val, funL, funR = Eigensystem(A) | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | <file Quanty_Output> | ||
| + | WARNING: non hermitian matrix found | ||
| + | Using left and right handed eigensystem | ||
| + | With potential complex eigenvalues | ||
| + | The eigenvalues are | ||
| + | { -3.8133538424944 , -0.86687641096757 , 9.680230253462 } | ||
| + | The left eigenfunctions are | ||
| + | { { 0.139 , -0.6419 | ||
| + | { -0.974 | ||
| + | { -0.5567 | ||
| + | |||
| + | The right eigenfunctions are | ||
| + | { { -0.3991 | ||
| + | { -0.9178 | ||
| + | { -0.2901 | ||
| + | |||
| + | The matrix transformed to a diagonal matrix by its eigenfunctions is | ||
| + | { { -3.8134 , 0 , 0 } , | ||
| + | { 0 , -0.8669 , 0 } , | ||
| + | { 0 , 0 , 9.6802 } } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Example ===== | ||
| + | |||
| + | ### | ||
| + | For an Hermitian matrix with small non-Hermitian part | ||
| + | ### | ||
| + | |||
| + | ==== Input ==== | ||
| + | <code Quanty Example.Quanty> | ||
| + | A = Matrix.New({{1, | ||
| + | {1-1E-7, | ||
| + | {3,5,1}}) | ||
| + | val, funL, funR = Eigensystem(A) | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | |||
| + | print(" | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | <file Quanty_Output> | ||
| + | WARNING: non hermitian matrix found | ||
| + | Using left and right handed eigensystem | ||
| + | With potential complex eigenvalues | ||
| + | The eigenvalues are | ||
| + | { -3.7873476689872 , 0.64886022722351 , 8.1384874417637 } | ||
| + | The left eigenfunctions are | ||
| + | { { -0.3763 | ||
| + | { -0.853 | ||
| + | { -0.3616 | ||
| + | |||
| + | The right eigenfunctions are | ||
| + | { { -0.3763 | ||
| + | { -0.853 | ||
| + | { -0.3616 | ||
| + | |||
| + | The matrix transformed to a diagonal matrix by its eigenfunctions is | ||
| + | { { -3.7873 , 0 , 0 } , | ||
| + | { 0 , 0.6489 , 0 } , | ||
| + | { 0 , 0 , 8.1385 } } | ||
| + | |||
| + | The left and right hand vectors are now only marginally different | ||
| + | { { -3.7873 , -5.4e-8 , 2.3e-9 } , | ||
| + | { 9.2e-9 , 0.6489 , -6.7e-9 } , | ||
| + | { -4.9e-9 , -8.4e-8 , 8.1385 } } | ||
| + | </ | ||
| + | |||
| + | |||
| ===== Table of contents ===== | ===== Table of contents ===== | ||
| {{indexmenu> | {{indexmenu> | ||