0
私はこのような機能を持っていますが、問題は最初の列を置き換え、次の列を置き換えるときに前の列が元の形に戻りません。numpyの列を1つだけ置き換える方法は?
import numpy as np
from numpy import linalg as la
def CramersRule(A,b):
for c in range (n):
detA1 = la.det(A)
A[:,c] = b.transpose()
print A
x = la.det(A)/detA1
print ("X%d: ")%(c+1),x
n = input ("Enter size of matrix nxn: ")
coeff_matrix = input ("\nEnter coefficient matrix A: ")
vec_constants = input ("Enter vector of constants b: ")
A = np.array(coeff_matrix)
b = np.array(vec_constants)
print A
CramersRule(A, b)