Why does eig(A) not return a symbolic array for my symbolic matrix A?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Lucas Medina
le 9 Juil 2015
Réponse apportée : Stefan Wehmeier
le 14 Juil 2015
I have made a matrix C1 whose entries are all rationals formed from random numbers which I've casted with sym: sym(-10 + (10 + 10)*rand(n), 'f'). I believe this means that C1 is a symbolic matrix.
However, when I perform e = eig(C1) or [V,D]=eig(C1), I get rounded values... let me give you an example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152043/image.png)
But eig(C1) returns:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152045/image.png)
I have tried casting C1 beforehand by doing C1 = sym(C1, 'f'), but I receive the same result. If I instead try sym(eig(C1), 'f'), I get the error:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152047/image.png)
These values are not in symbolic form, the same happens when I try to obtain the right/left eigenvectors of C1. I would like these to be in symbolic form in order to avoid rounding once I perform operations on them. How can I fix this?
0 commentaires
Réponse acceptée
Stefan Wehmeier
le 14 Juil 2015
The roots of polynomials of degree > 4 usually do not have a symbolic representation. The same holds for eigenvalues as they are the roots of the characteristic polynomial. This may not be satisfactory, but it is the best "symbolic" answer you can get. If you want it, enter
solve(poly2sym(charpoly(C1)))
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!