借助sympy.eigenvals()
方法,我們可以通過使用矩陣找到特征值sympy.eigenvals()
方法。
用法:sympy.eigenvals()
返回:Return eigenvalues of a matrix.
範例1:
在這個例子中,我們可以通過使用sympy.eigenvals()
方法,我們能夠找到矩陣的特征值。
# 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)
輸出:
{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}
範例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)
輸出:
{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}
相關用法
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python os.listdir()用法及代碼示例
- Python os.umask()用法及代碼示例
- Python sympy.eye()用法及代碼示例
- Python os.fstatvfs()用法及代碼示例
- Python os.uname()用法及代碼示例
- Python os.chroot()用法及代碼示例
- Python os.stat()用法及代碼示例
- Python sympy.tan()用法及代碼示例
- Python os.writev()用法及代碼示例
- Python os.write()用法及代碼示例
- Python sympy.sin()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy.eigenvals() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。