本文整理汇总了Python中sympy.matrices.Matrix.charpoly方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.charpoly方法的具体用法?Python Matrix.charpoly怎么用?Python Matrix.charpoly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.matrices.Matrix
的用法示例。
在下文中一共展示了Matrix.charpoly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: demo_eigen_number
# 需要导入模块: from sympy.matrices import Matrix [as 别名]
# 或者: from sympy.matrices.Matrix import charpoly [as 别名]
def demo_eigen_number():
m = Matrix(3,3,[2,1,0,0,2,1,0,0,2])
pprint(m)
print "\nany n*n matrix has n complex eigen values, counted with multiplications\n"\
"since the characteritic polynomial is n-dim\n"\
"and Fundamental Theorem of Algebra gives us exactly n roots:"
pprint(m.charpoly().as_expr())
print"\neach distinct eigen value as at least 1 at most multiplication eigen vectors\n"\
"but it's possible to have less than multiplication number of eigen vectors\n"\
"the given matrix is an example with only 1 eigen vector:\n"
pprint(m.eigenvects())
print "to see this for any vector v we can compute M * v:\n"
v = IndexedBase('v')
vec = Matrix(m.rows, 1, lambda i, j: v[i+1])
pprint(vec)
pprint(m*vec)