修改於2020年10月01日
問題或建議,請留言!
詞彙單位矩陣eye()逆矩陣定義及性質代碼畫圖檢驗
單位矩陣
1import numpy as np
2A = np.eye(3)
3print(A)
the space doesn’t change when we apply the identity matrix to it.
方陣(n x n)
,ad-bc 叫做A的行列式(determinant),記為det A
解
例
1import numpy as np
2A = np.array([[2, -1],
3 [1, 1]])
4# lin:linear alg:algebra
5A_inv = np.linalg.inv(A)
6b = np.array([[0],
7 [3]])
8x = A_inv.dot(b)
解得
1import numpy as np
2import matplotlib.pyplot as plt
3#-10 -> 10 不含10
4x = np.arange(-10, 10)
5y = 2*x
6y1 = -x + 3
7plt.figure(num="figure")
8plt.plot(x, y)
9plt.plot(x, y1)
10plt.xlim(0, 3)#設置x軸刻度範圍
11plt.ylim(0, 3)
12# draw axes
13# 畫出豎線 ,vertical
14plt.axvline(x=0, color='grey')
15# 畫出橫線 ,horizontal
16plt.axhline(y=0, color='grey')
17plt.show()
18plt.close()