Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| documentation:language_reference:objects:matrix:functions:tridiagonalize [2024/12/12 15:42] – created Maurits W. Haverkort | documentation:language_reference:objects:matrix:functions:tridiagonalize [2025/11/20 04:20] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ### | ### | ||
| - | alligned paragraph text | + | Matrix.Tridiagonalize(M) returns the matrix in triple-diagonal form. The first element returned is a try-diagonal response function representing the matrix. The second element returned is a matrix that represents the unitary matrix that transforms the Hermitian matrix M to try-diagonal form. Possible options include |
| ### | ### | ||
| + | * BlockSize | ||
| + | * NTri - the maximal number of tridiagonal blocks | ||
| + | * SingularValue | ||
| + | |||
| ===== Example ===== | ===== Example ===== | ||
| - | |||
| - | ### | ||
| - | description text | ||
| - | ### | ||
| ==== Input ==== | ==== Input ==== | ||
| <code Quanty Example.Quanty> | <code Quanty Example.Quanty> | ||
| - | -- some example code | + | M = Matrix.New({{1, |
| + | {1, | ||
| + | {1, | ||
| + | {1, | ||
| + | {1, | ||
| + | {1, | ||
| + | G1, U1 = Matrix.Tridiagonalize(M, | ||
| + | G2, U2 = Matrix.Tridiagonalize(M, | ||
| + | |||
| + | print(" | ||
| + | print(ResponseFunction.ToMatrix(G1)) | ||
| + | print(" | ||
| + | print(U2) | ||
| + | print(" | ||
| + | print(Chop(U1*M*Matrix.Transpose(U1))) | ||
| + | |||
| + | print(" | ||
| + | print(ResponseFunction.ToMatrix(G2)) | ||
| + | print(" | ||
| + | print(U2) | ||
| + | print(" | ||
| + | print(Chop(U2*M*Matrix.Transpose(U2))) | ||
| </ | </ | ||
| ==== Result ==== | ==== Result ==== | ||
| <file Quanty_Output> | <file Quanty_Output> | ||
| - | text produced | + | The matrix M in tri-diagonal form is |
| + | { { 1 , -2.2361 , 0 , 0 , 0 , 0 } , | ||
| + | { -2.2361 , 24.6 , | ||
| + | { 0 , 5.8515 , -0.7402 , -2.334 | ||
| + | { 0 , 0 , -2.334 | ||
| + | { 0 , 0 , 0 , 2.2758 , -3.2905 , 2.162 } , | ||
| + | { 0 , 0 , 0 , 0 , 2.162 , -1.0732 } } | ||
| + | |||
| + | The unitary matrix U1 that transforms M to tridiagonal form is given as | ||
| + | { { 1 , 0 , 0 , 0 , 0 , 0 } , | ||
| + | { 0 , 1 , 0 , 0 , 0 , 0 } , | ||
| + | { 0 , 0 , 0.8328 , 0.4502 , 0.0676 , -0.315 | ||
| + | { 0 , 0 , 0.0805 , 0.312 , 0.5435 , 0.7751 } , | ||
| + | { 3e-17 , 0 , 0.4415 , -0.8303 , 0.3361 , 0.0527 } , | ||
| + | { -8e-17 | ||
| + | |||
| + | And if we look at U^**M*U^T we get | ||
| + | { { 1 , -2.2361 , 0 , 0 , 0 , 0 } , | ||
| + | { -2.2361 , 24.6 , | ||
| + | { 0 , 5.8515 , -0.7402 , -2.334 | ||
| + | { 0 , 0 , -2.334 | ||
| + | { 0 , -3e-15 | ||
| + | { 0 , 0 , 0 , 0 , 2.162 , -1.0732 } } | ||
| + | |||
| + | The matrix M in Block tri-diagonal form is | ||
| + | { { 1 , 1 , 1.0355 , 1.7111 , 0 , 0 } , | ||
| + | { 1 , 1 , 1.7111 , 7.1465 , 0 , 0 } , | ||
| + | { 1.0355 , 1.7111 , 2.0149 , 11.884 , 1.062 , 0.4744 } , | ||
| + | { 1.7111 , 7.1465 , 11.884 , 16.985 , 0.4744 , 3.0368 } , | ||
| + | { 0 , 0 , 1.062 , 0.4744 , 0.8681 , 0.9176 } , | ||
| + | { 0 , 0 , 0.4744 , 3.0368 , 0.9176 , -3.8681 } } | ||
| + | |||
| + | The unitary matrix U2 that transforms M to tridiagonal form is given as | ||
| + | { { 1 , 0 , 0 , 0 , 0 , 0 } , | ||
| + | { 0 , 1 , 0 , 0 , 0 , 0 } , | ||
| + | { 0 , 0 , 0.8328 , 0.4502 , 0.0676 , -0.315 | ||
| + | { 0 , 0 , 0.0805 , 0.312 , 0.5435 , 0.7751 } , | ||
| + | { 0 , 0 , 0.4415 , -0.8303 , 0.3361 , 0.0527 } , | ||
| + | { 0 , 0 , -0.3242 , 0.1032 , 0.7662 , -0.5452 } } | ||
| + | |||
| + | And if we look at U^**M*U^T we get | ||
| + | { { 1 , 1 , 1.0355 , 1.7111 , 0 , 0 } , | ||
| + | { 1 , 1 , 1.7111 , 7.1465 , 0 , 0 } , | ||
| + | { 1.0355 , 1.7111 , 2.0149 , 11.884 , 1.062 , 0.4744 } , | ||
| + | { 1.7111 , 7.1465 , 11.884 , 16.985 , 0.4744 , 3.0368 } , | ||
| + | { 0 , 0 , 1.062 , 0.4744 , 0.8681 , 0.9176 } , | ||
| + | { 0 , 0 , 0.4744 , 3.0368 , 0.9176 , -3.8681 } } | ||
| </ | </ | ||