Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Cramers-rule/Python/cramers-rule.py
Normal file
13
Task/Cramers-rule/Python/cramers-rule.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
def det(m,n):
|
||||
if n==1: return m[0][0]
|
||||
z=0
|
||||
for r in range(n):
|
||||
k=m[:]
|
||||
del k[r]
|
||||
z+=m[r][0]*(-1)**r*det([p[1:]for p in k],n-1)
|
||||
return z
|
||||
w=len(t)
|
||||
d=det(h,w)
|
||||
if d==0:r=[]
|
||||
else:r=[det([r[0:i]+[s]+r[i+1:]for r,s in zip(h,t)],w)/d for i in range(w)]
|
||||
print(r)
|
||||
Loading…
Add table
Add a link
Reference in a new issue