Why Matlab/Mupad ignores absolute value when multiplying complex conjugate expressions

3 views (last 30 days)
Hello everyone,
Recently, I recognized that Matlab (as well as Mupad) ignores to take the absolute value when multiplying a variable with its complex conjugate. I'm currently trying to calculate the eigenvalues of an 4 x 4 Hermitian matrix and I believe that this issue results in wrong eigenvalues. Take for example the matrix (now in Mupad):
assume(x, Type::Real)
M := matrix([[0,conjugate(I*x),0,0], [I*x,0,0,0], [0,0,1,conjugate(I*x)], [0,0,I*x,1]])
then the eigenvalues from Mupad are linalg::eigenvalues(M) => {x, 1-x, -x, x+1}. That's wrong! It should be: {|x| 1-|x|, -|x|, x+1}.
Can anyone help ? Thanks.
Best regards
Bernhard
  3 Comments
Bernhard Ihrig
Bernhard Ihrig on 10 Aug 2015
Edited: Bernhard Ihrig on 10 Aug 2015
Thanks for your comment Torsten. However, the problem with the matrix remains, because it seems that Mupad calculates sqrt(x^2) = x (?). If you calculate the eigenvalues of the example matrix M by hand, you will see what I'm intending to say, hopefully.
Best regards
Bernhard

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 10 Aug 2015
If x is -1, then the eigenvalues returned by MuPAD are -1, 2, 1, 0. The eigenvalues you expected are 1, 0, -1, 2 (assuming you meant |x|+1 as your last expression.) They're the same, just in a different order.
More generally, since both |x| and -|x| are eigenvalues in your list of expected eigenvalues and you told MuPAD it can assume x is real, that's the same as including x and -x in the list of eigenvalues. They'll just be listed in a different order if x is negative. Similarly for real x, 1-|x| and 1+|x| are the same as 1-x and 1+x, just in a different order if x is negative.
Now if you assumed x was Type::Complex, and called:
simplify(linalg::eigenvalues(M))
then the sets {|x|, -|x|} and {x, -x} are NOT necessarily the same but in a different order. In that case, MuPAD knows it cannot eliminate the absolute value signs, and indeed when I make that modification to your assume call the results do include the absolute value signs.
  1 Comment
Bernhard Ihrig
Bernhard Ihrig on 10 Aug 2015
Hello Steven,
many thanks for your answer. For me it appears still weird, but hopefully I will now get the right eigenvalues.
Best regards
Bernhard

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!