问题遇到的现象和发生背景
AttributeError: 'matrix' object has no attribute 'diagonalize'. Did you mean: 'diagonal'?这个问题怎么解决
问题相关代码,请勿粘贴截图
import numpy
M = numpy.matrix([[3, -2, 4, -2], [5, 3, -3, -2], [5, -2, 2, -2], [5, -2, -3, 3]])
print("计算矩阵的对角化矩阵")
P, D = M.diagonalize()
print(P)
print(D)
运行结果及报错内容
Traceback (most recent call last):
File "G:\python\demo.py", line 39, in
P, D = M.diagonalize()
AttributeError: 'matrix' object has no attribute 'diagonalize'. Did you mean: 'diagonal'?
计算矩阵的对角化矩阵
进程已结束,退出代码1
我的解答思路和尝试过的方法
我想要达到的结果
计算矩阵对角化