2 Corrected char count, optimized a bit

Python3 - 262310

def det(m,n):
if n==1: return m
z=0
for r in range(n):
k=m[:]
del k[r]
z+=m[r]*powz+=m[r]*(-1,r)*det**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)


The determinant is calculated using Laplace's formula, nothing fancy :)

Supply the matrix and the known terms respectively in an array named h and t, like this

h = [[2, 1, 1],[1, -1, -1],[1, 2, 1]]
l = [3, 0, 0]


Which gives

[1.0, -2.0, 3.0]


Python3 - 262

def det(m,n):
if n==1: return m
z=0
for r in range(n):
k=m[:]
del k[r]
z+=m[r]*pow(-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)


The determinant is calculated using Laplace's formula, nothing fancy :)

Supply the matrix and the known terms respectively in an array named h and t, like this

h = [[2, 1, 1],[1, -1, -1],[1, 2, 1]]
l = [3, 0, 0]


Which gives

[1.0, -2.0, 3.0]


Python3 - 310

def det(m,n):
if n==1: return m
z=0
for r in range(n):
k=m[:]
del k[r]
z+=m[r]*(-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)


The determinant is calculated using Laplace's formula, nothing fancy :)

Supply the matrix and the known terms respectively in an array named h and t, like this

h = [[2, 1, 1],[1, -1, -1],[1, 2, 1]]
l = [3, 0, 0]


Which gives

[1.0, -2.0, 3.0]

1

Python3 - 262

def det(m,n):
if n==1: return m
z=0
for r in range(n):
k=m[:]
del k[r]
z+=m[r]*pow(-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)


The determinant is calculated using Laplace's formula, nothing fancy :)

Supply the matrix and the known terms respectively in an array named h and t, like this

h = [[2, 1, 1],[1, -1, -1],[1, 2, 1]]
l = [3, 0, 0]


Which gives

[1.0, -2.0, 3.0]