Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: symbolic solver question
Replies: 3   Last Post: Dec 15, 2012 12:37 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Paul Mennen

Posts: 277
Registered: 12/7/04
symbolic solver question
Posted: Dec 12, 2012 6:04 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Here is my matlab session:

>> syms s a A
>> A = [0 0 -2*a a; 0 0 a -2*a; 1 0 0 0; 0 1 0 0];
>> eig(A)


ans =

(-a)^(1/2)
-(-a)^(1/2)
3^(1/2)*(-a)^(1/2)
-3^(1/2)*(-a)^(1/2)

OK, so far so good.
I asked for the eigenvalues of the matrix A and it shows the 4 eigenvalues that I expected. So then for the sake of understanding the solver, I though I would try to compute the eigenvalues by setting the determinant of (sI-A) equal to zero:

>> solve('det(s*eye(4)-A) = 0',s)
Warning: Explicit solution could not be found.

Why doesn't this work?
After some experimentation I found this works:

>> solve([char(det(s*eye(4)-A)) '= 0'],s)

ans =

(-a)^(1/2)
-(-a)^(1/2)
3^(1/2)*(-a)^(1/2)
-3^(1/2)*(-a)^(1/2)

So as you can see the solver can compute the eigenvalues correctly, but this form of having to convert the determinant to a character array seems kind of awkward. Is that necessary, or is there a simpler way of entering this equation into the solver?

Thanks
~Paul



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.