Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Would be nice if Mathcad Prime included internal routine for the Schur and Jordan decompositions of a matrix.
Has anyone developed a Mathcad Prime routine to return the Schur and Jordan decompositions of a matrix?
Thanks for any help.
Solved! Go to Solution.
Terry,
See attached - I think I cracked it. I finally got Schur decomposition to work on matrix with a mix of real and pairs of complex conjugate eigenvalues with reduced iterations. Also added routine to get eigenvectors from Schur decomposition. 😊
I think this should be considered an accepted solution. Do you agree?
Now need to work on a Mathcad version of the Jordan decomposition with repeated eigenvalues.
It would be nice if Mathcad included efficient versions of the Schur and Jordan decomposition for eigenvalues and eigenvectors in their list of matrix functions.😩
I wanted to add ViadimirN and Werner_E to posting, but don't see how to do it.
Thanks all for your help😊
LarryJ
You can look at an old discussion here - "Jordansche Normalform of a matrix": https://community.ptc.com/t5/Mathcad/Jordansche-Normalform-of-a-matrix/td-p/81283
Thanks for the Link -- interesting discussion but I was looking for a mathcad algorithm that someone may have developed in the past.
Hi Larry,
Here is the Schur decomposition for real matrix and real eigenvalues, have not developed the complex number algorithm yet.
Following are two examples from different sources.
Cheers
Terry
Hi,
Realize the iterative solution often needs far less than 2 million iterations.
Here is a solution that defines the maximum number of iterations "n" and an accuracy in decimal places "d"
Cheers
Terry
This is better solution -- will it work for complex matrix?
What is
Thanks
Hi,
SchurNorm() is a mistake it should read SchurHalt() Oops
Cheers
Terry.
Terry -- see attached -- I added shifting procedure to reduce the number of iterations. Works well except for matrices that have pairs of complex conjugate eigenvalues. Any ideas?
Terry,
See attached - I think I cracked it. I finally got Schur decomposition to work on matrix with a mix of real and pairs of complex conjugate eigenvalues with reduced iterations. Also added routine to get eigenvectors from Schur decomposition. 😊
I think this should be considered an accepted solution. Do you agree?
Now need to work on a Mathcad version of the Jordan decomposition with repeated eigenvalues.
It would be nice if Mathcad included efficient versions of the Schur and Jordan decomposition for eigenvalues and eigenvectors in their list of matrix functions.😩
I wanted to add ViadimirN and Werner_E to posting, but don't see how to do it.
Thanks all for your help😊
LarryJ
Larry,
Yes think you can take your work as answering the question. Well done.
Cheers
Terry
Thats a lot of iterations -- I like your next submittal better. Thanks for the quick response..
Hi Larry,
Have tested with complex numbers in the matrix with complex eigenvalues,
Function SchurHalt(A,n,d) works unaltered with complex numbers.
The only change is the last check using the decomposition to check you get the original matrix.
Cheers
Terry
The only change is the last check using the decomposition to check you get the original matrix.
I am out of my comfort zone, but U being a unitary matrix, the inverse of U equals the transposed of the matrix of the conjugate values:
Actually we should vectorize additionally, but Prime applies implicit vectorization because there is no such thing like the conjugate of a whole matrix.
Yes, should be conjugate transpose as you indicated when dealing with complex matrices.
Great job, the only improvement would be to accelerate the convergency to reduce the number of iterations.
Thanks for your help.
Hi Terry,
See attached File. I included more examples and alternate procedures in an attempt to accelerate convergence to solution but to no practical avail. Note Schurv is cheating since the eignvalues and vectors are computed using Mathcad eigenvals and eigenvecs and then using QR to calculate Schur decomposition. In either procedure the method does not converge well for matrix with repeated roots or singular matrix or in some cases for a matrix with a pair of complex conjugate roots. If all roots are real and unique (not repeated or close to each other) convergence is reasonable. Apparently, convergence can be improved by first reducing the matrix to Hessenberg form and then doing shifts which requires more detailed coding.
Thanks for your help.
Larry
Terry, see attached -- I added a program to calculate Hessenberg decomposition as initial condition for Schur in an effort to increase convergency. It only helped in one case of the examples but it was interesting in its own right.
Hi,
Jordan Decomposition.
3x3 file has commentary, 4x4 file just does the calculations.
Thanks for the contribution. I'll have to figure out how to program that process.