Why is jordan() much slower than eig()? Both in symbolic forms

조회 수: 13(최근 30일)
HAOCHENG LUO
HAOCHENG LUO 2019년 8월 17일
댓글: HAOCHENG LUO 2019년 8월 27일
I have a sparse matrix (attached), and I want to obtain its Jordan canonical form. I used [V,D]=jordan(sym(A)), and found that this matrix is diagonalizable. So I also tried [V,D]=eig(sym(A)), and found eig() is much faster than jordan(). As they are both in symbolic form, I wonder why this happens.
A further question is that, I want to use the obtained decompostion matrices to conduct stablity analysis, which of the following choices is safer? Or, they are all not safe due to numerical problems?
  1. [V,D]=jordan(sym(A)); V=eval(V); D=eval(D);
  2. [V,D]=eig(sym(A)); V=eval(V); D=eval(D);
  3. [V,D]=jordan(A);
  4. [V,D]=eig(A);
Thanks!

채택된 답변

Sourav Bairagya
Sourav Bairagya 2019년 8월 20일
Difference between speed of two functions came from the difference between the algorithms used in the implementation of the two functions. Speed also depends on the type of the problem that is being solved.
The difficulty with the Jordan Canonical Form is that it is extremely sensitive to any kind of perturbation or error in data, arithmetic roundoff error or linearization of nonlinear functions. If any of those occurs, then the JCF as well as the Transformation it generates will get changed. Hence, it is always necessary to convert numeric inputs to exact symbolic form before using “jordan” function to compute JCF of a matrix. By converting your data into its exact symbolic form, your data will remain protected from the above-mentioned errors.
For “eig” there is no such issues. But, again for safety, you can convert your data into exact symbolic form before using that function. Hence, it is safer to use 1 and 2 from the choices you have given.
  댓글 수: 1
HAOCHENG LUO
HAOCHENG LUO 2019년 8월 27일
THX! Perfect answer!
For "eig", I also found that though I used [V,D]=eig(sym(A)), the returned matrices "V" and "D" are float point numbers. Does this mean that matlab calculated them in symbolic form but outputed them in numbers?
Another question is that is there an efficient way that I can check if my matrix is diagonalizable without computing all the eigenvectors? I know in the attaiched case, it can be checked by showing that this matrix has distinct eigenvalues, but what if it has repeated eigenvalue (with the same sparsity structure as the attached matrix)?

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by