习题2.12代码
import numpy as np
import pandas as pd
import sympy as sp
sp.init_printing(use_unicode=True)
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['Times New Roman + SimSun + WFM Sans SC']
plt.rcParams['mathtext.fontset']='cm'
Times New Roman + SimSun + WFM Sans SC
simsum宋体, times new roman -*, simhei黑体, kaiti楷体,
dengxian等线, fangsong仿宋, Microsoft Yahei微软雅黑
plt.rcParams['axes.unicode_minus']=False
plt.rcParams['figure.dpi'] = 200
plt.rcParams['figure.figsize'] = [4, 3]
plt.rcParams['font.size'] = 12
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
A = np.array([[-1, 1, 0], [-4, 3, 0], [1, 0, 2]])
va1,ve1 = np.linalg.eig(A)
va1, ve1
A = sp.Matrix([[-1, 1, 0], [-4, 3, 0], [1, 0, 2]])
va2 = A.eigenvals()
ve2 = A.eigenvects()
va2, ve2
print(va2); print(ve2)