I have the following problem using numpy 1.3.0 and MATLAB 7.9.0: the python code
import numpy as np
Lu = [[1.01250000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-0.00250000000000000,1.01250000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,-0.00250000000000000,1.01250000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,-0.00250000000000000,1.01250000000000,0,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0,0,0,0],[-0.00250000000000000,0,0,0,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0,0,0],[0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0,0],[0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0,0],[0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,0,0,0,-0.00250000000000000,0,0,0,0,0,0,0,0],[0,0,0,0,-0.00250000000000000,0,0,0,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0,0],[0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0,0],[0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0,0,0],[0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,0,0,0,-0.00250000000000000,0,0,0,0],[0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,0,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0,0],[0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0,0],[0,0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,-0.00250000000000000,0,0,-0.00250000000000000,0],[0,0,0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01000000000000,0,0,0,-0.00250000000000000],[0,0,0,0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,0,1.01250000000000,-0.00250000000000000,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01250000000000,-0.00250000000000000,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01250000000000,-0.00250000000000000],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-0.00250000000000000,0,0,-0.00250000000000000,1.01250000000000]]
rhs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0.0050, 0.0050, 0.0050, 0.0050]
Lu = np.array(Lu)
rhs = np.array(rhs)
ans = np.linalg.solve(Lu,rhs)
print ans
产出
[ 1.87241716e-13 1.89545264e-13 1.89545264e-13 1.87241716e-13
7.56433496e-11 7.63890449e-11 7.63890449e-11 7.56433496e-11
3.04833369e-08 3.07089522e-08 3.07089522e-08 3.04833369e-08
1.22844835e-05 1.23451480e-05 1.23451480e-05 1.22844835e-05
4.95055571e-03 4.96277946e-03 4.96277946e-03 4.95055571e-03]
whereas using backslash in MATLAB 产出
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0050 0.0050 0.0050 0.0050
我没有发现任何其他线性薄膜等系统,这种系统产生不同的解决办法。 目前,我已经离开城镇,因此无法检查,不同版本的 n(不同计算机)是否会产生正确的结果。 否。 是否解决利用这一系统的正确职能(系统矩阵L正在稀少)? 难道这是我版本的 n吗? 我的法典中是否有问题?
感谢!