Python sympy Matrix.eigenvects()方法
在sympy.Matrix().eigenvects()方法的帮助下,我们可以找到矩阵的特征向量。eigenvects()方法返回一个形式为(特征值:代数倍率,[特征向量])的图元列表。
语法: Matrix().eigenvects()
返回:返回一个形式为(特征值:代数倍数,[特征向量])的图元列表。
示例 #1:
# import sympy
from sympy import * M = Matrix([[3, -2, 4, -2],
[5, 3, -3, -2],
[5, -2, 2, -2],
[5, -2, -3, 3]])
print("Matrix : {} ".format(M))
# Use sympy.eigenvects() method
M_eigenvects = M.eigenvects()
print("Eigenvects of a matrix : {}".format(M_eigenvects))
输出:
Matrix : Matrix([[3, -2, 4, -2], [5, 3, -3, -2], [5, -2, 2, -2], [5, -2, -3, 3]])
Eigenvects of a matrix : [(-2, 1, [Matrix([
[0],
[1],
[1],
[1]])]), (3, 1, [Matrix([
[1],
[1],
[1],
[1]])]), (5, 2, [Matrix([
[1],
[1],
[1],
[0]]), Matrix([
[ 0],
[-1],
[ 0],
[ 1]])])]
示例 #2:
# import sympy
from sympy import * M = Matrix([[1, -3, 3], [3, -5, 3], [6, -6, 4]])
print("Matrix : {} ".format(M))
# Use sympy.eigenvects() method
M_eigenvects = M.eigenvects()
print("Eigenvects of a matrix : {}".format(M_eigenvects))
输出:
Matrix : Matrix([[1, -3, 3], [3, -5, 3], [6, -6, 4]])
Eigenvects of a matrix : [(-2, 2, [Matrix([
[1],
[1],
[0]]), Matrix([
[-1],
[ 0],
[ 1]])]), (4, 1, [Matrix([
[1/2],
[1/2],
[ 1]])])]