I have a simple problem in Python that is very very strange.
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)
...
As you see below, the matrix matriz
is changed in spite of the fact that aux
is the one being changed by the function solucoes()
.
Matrix before:
[[7, 8, 9, 24], [8, 9, 10, 27], [9, 10, 8, 27]]
Matrix after:
[[7, 8, 9, 24], [0.0, -0.14285714285714235, -0.2857142857142847, -0.42857142857142705],
[0.0, 0.0, -3.0, -3.0000000000000018]]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…