我在 Python 中有一个非常非常奇怪的简单问题。
def estExt(matriz,erro):
# (1) Determinar o vector X das soluções
print ("Matrix after:");
print(matriz);
aux=matriz;
x=solucoes(aux); # IF aux is a copy of matrix, why the matrix is changed??
print ("Matrix before: ");
print(matriz)
...
如下所示,矩阵matriz
尽管事实发生了变化aux
是被函数改变的solucoes()
.
之前的矩阵:
[[7, 8, 9, 24], [8, 9, 10, 27], [9, 10, 8, 27]]
之后的矩阵:
[[7, 8, 9, 24], [0.0, -0.14285714285714235, -0.2857142857142847, -0.42857142857142705],
[0.0, 0.0, -3.0, -3.0000000000000018]]