# Python | sympy.eigenvals() method

With the help of `sympy.eigenvals()` method, we can find the eigenvalues of a matrix by using `sympy.eigenvals()` method.

Syntax : `sympy.eigenvals()`
Return : Return eigenvalues of a matrix.

Example #1 :
In this example, we can see that by using `sympy.eigenvals()` method, we are able to find the eigenvalues of a matrix.

 `# import sympy ` `from` `sympy ``import` `*` ` `  `# Use sympy.eigenvals() method ` `mat ``=` `Matrix([[``1``, ``0``, ``1``], [``2``, ``-``1``, ``3``], [``4``, ``3``, ``2``]]) ` `d ``=` `mat.eigenvals() ` `  `  `print``(d) `

Output :

{2/3 + 46/(9*(241/54 + sqrt(36807)*I/18)**(1/3)) + (241/54 + sqrt(36807)*I/18)**(1/3): 1, 2/3 + 46/(9*(-1/2 + sqrt(3)*I/2)*(241/54 + sqrt(36807)*I/18)**(1/3)) + (-1/2 + sqrt(3)*I/2)*(241/54 + sqrt(36807)*I/18)**(1/3): 1, 2/3 + (-1/2 – sqrt(3)*I/2)*(241/54 + sqrt(36807)*I/18)**(1/3) + 46/(9*(-1/2 – sqrt(3)*I/2)*(241/54 + sqrt(36807)*I/18)**(1/3)): 1}

Example #2 :

 `# import sympy ` `from` `sympy ``import` `*` ` `  `# Use sympy.eigenvals() method ` `mat ``=` `Matrix([[``1``, ``5``, ``1``], [``12``, ``-``1``, ``31``], [``4``, ``33``, ``2``]]) ` `d ``=` `mat.eigenvals() ` `  `  `print``(d) `

Output :

{2/3 + 3268/(9*(16225/54 + sqrt(15482600967)*I/18)**(1/3)) + (16225/54 + sqrt(15482600967)*I/18)**(1/3): 1, 2/3 + 3268/(9*(-1/2 + sqrt(3)*I/2)*(16225/54 + sqrt(15482600967)*I/18)**(1/3)) + (-1/2 + sqrt(3)*I/2)*(16225/54 + sqrt(15482600967)*I/18)**(1/3): 1, 2/3 + (-1/2 – sqrt(3)*I/2)*(16225/54 + sqrt(15482600967)*I/18)**(1/3) + 3268/(9*(-1/2 – sqrt(3)*I/2)*(16225/54 + sqrt(15482600967)*I/18)**(1/3)): 1}

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.