习题2.8
1.代码实现
点击查看代码
import numpy as np
n=1000
A=np.zeros((n,n))
b=np.arange(1,n+1)
np.fill_diagonal(A[1:,:-1],1)
np.fill_diagonal(A[:-1,1:],1)
np.fill_diagonal(A[:-1,1:],1)
x=np.linalg.solve(A,b)
print("解为:")
print(x[:5])
print("...")
print(x[-5:])
print("学号:3014")
2.运行结果