Skip to content

Commit 3d0163b

Browse files
authored
Create lin_alg_solve.py
1 parent 86cb6a6 commit 3d0163b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lin_alg_solve.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from numpy import array
2+
from scipy.linalg import solve
3+
4+
M = array([[1/5.,1,-1,0,1,1/2.],
5+
[1,0,-3,5,-2,-2],
6+
[1,1,2,-1,3,-2],
7+
[1,-1,-1,1,1./2,-1],
8+
[-1,5,-1,2,0,1],
9+
[-1,1,-1,0,0,-6]], float)
10+
11+
answer = array([24.1312, 46.2798,-61.8372,31.1466,51.2106,-5.7008])
12+
13+
print solve(M, answer)
14+
15+
16+
# [-225.76371598 -88.06783231 -3.09392272 119.13851089 142.05030225 24.41510107]

0 commit comments

Comments
 (0)