Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
documentation:language_reference:objects:matrix:functions:eigensystem [2024/12/12 17:16] Maurits W. Haverkortdocumentation:language_reference:objects:matrix:functions:eigensystem [2024/12/12 17:32] (current) Maurits W. Haverkort
Line 37: Line 37:
   {  0      ,  0      ,  8.6691 } }   {  0      ,  0      ,  8.6691 } }
 </file> </file>
 +
 +
 +===== Example =====
 +
 +###
 +For a non-Hermitian matrix
 +###
 +
 +==== Input ====
 +<code Quanty Example.Quanty>
 +A = Matrix.New({{1,1,3},
 +                {5,3,7},
 +                {3,5,1}})
 +val, funL, funR = Eigensystem(A)
 +print("The eigenvalues are\n",val)
 +print("The left  eigenfunctions are\n",funL)
 +print("The right eigenfunctions are\n",funR)
 +print("The matrix transformed to a diagonal matrix by its eigenfunctions is\n",Chop( Matrix.Conjugate(funL) * A * Matrix.Transpose(funR)) )
 +</code>
 +
 +==== 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.847          } ,
 +  { -0.974          ,  0.4605         , -0.1613         } ,
 +  { -0.5567         , -0.5736         , -0.655          } }
 +
 +The right eigenfunctions are
 +{ { -0.3991         , -0.5551         ,  0.8254         } ,
 +  { -0.9178         ,  0.3854         ,  0.4427         } ,
 +  { -0.2901         , -0.8128         , -0.5684         } }
 +
 +The matrix transformed to a diagonal matrix by its eigenfunctions is
 +{ { -3.8134 ,  0      ,  0      } ,
 +  {  0      , -0.8669 ,  0      } ,
 +  {  0      ,  0      ,  9.6802 } }
 +</file>
 +
 +
 +===== Example =====
 +
 +###
 +For an Hermitian matrix with small non-Hermitian part
 +###
 +
 +==== Input ====
 +<code Quanty Example.Quanty>
 +A = Matrix.New({{1,1,3},
 +                {1-1E-7,3,5},
 +                {3,5,1}})
 +val, funL, funR = Eigensystem(A)
 +print("The eigenvalues are\n",val)
 +print("The left  eigenfunctions are\n",funL)
 +print("The right eigenfunctions are\n",funR)
 +print("The matrix transformed to a diagonal matrix by its eigenfunctions is\n",Chop( Matrix.Conjugate(funL) * A * Matrix.Transpose(funR)) )
 +
 +print("The left and right hand vectors are now only marginally different\n",Chop( Matrix.Conjugate(funL) * A * Matrix.Transpose(funL)) )
 +</code>
 +
 +==== 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.5129         ,  0.7715         } ,
 +  { -0.853          ,  0.5169         , -0.0725         } ,
 +  { -0.3616         , -0.6854         , -0.632          } }
 +
 +The right eigenfunctions are
 +{ { -0.3763         , -0.5129         ,  0.7715         } ,
 +  { -0.853          ,  0.5169         , -0.0725         } ,
 +  { -0.3616         , -0.6854         , -0.632          } }
 +
 +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 } }
 +</file>
 +
 +
  
 ===== Table of contents ===== ===== Table of contents =====
 {{indexmenu>..:#2|tsort}} {{indexmenu>..:#2|tsort}}
  
Print/export