Complex representation of eigenvalues of a symbolic 2x2 matrix

2 views (last 30 days)
NIkita Konoplev
NIkita Konoplev on 9 Oct 2021
Answered: Paul on 9 Oct 2021
Creating following matrix
syms a
A = [0, 1;
-1, 2*cos(a)];
and taking out its eigenvalues
lambda = eig(A)
the result I get is
lambda =
cos(a) + ((cos(a) - 1)*(cos(a) + 1))^(1/2)
cos(a) - ((cos(a) - 1)*(cos(a) + 1))^(1/2)
but I expect to see
lambda =
cos(a) + sin(a)*1i
cos(a) - sin(a)*1i
What should I do?

Answers (2)

Star Strider
Star Strider on 9 Oct 2021
This is likely as close as it is possible to get —
syms a
A = [0, 1;
-1, 2*cos(a)];
lambda = eig(A)
lambda = 
lambda = simplify(rewrite(lambda, 'sin'), 500)
lambda = 
Otherwise use the subs function to change to .
.

Paul
Paul on 9 Oct 2021
Is the expected result obtained only when a is real?
syms a
A = [0, 1;
-1, 2*cos(a)];
lambda = rewrite(simplify(eig(A),100),'sin')
lambda = 
simplify(lambda)
ans = 
Now add the additional assumption on a:
assume(a,'real')
simplify(lambda)
ans = 

Categories

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!