0

So i have this matrix :

[[ 1.   25.   -5.    1.  ]
 [ 1.   11.56 -3.4   1.  ]
 [ 1.    4.   -2.    1.  ]
 [ 1.    0.64 -0.8   1.  ]
 [ 1.    0.    0.    1.  ]
 [ 1.    1.44  1.2   1.  ]
 [ 1.    6.25  2.5   1.  ]
 [ 1.   16.    4.    1.  ]
 [ 1.   25.    5.    1.  ]
 [ 1.   49.    7.    1.  ]
 [ 1.   72.25  8.5   1.  ]]

where I made the second column the third but squared using this code

[rowA,colA] = np.shape(A)
for i in range(rowA):
A[i,1] = deepcopy ( A[i,2] ** 2 )

this thing works

but when I'm trying to edit the first column so that it will be also the third one but cubed

i get this matrix

[[-1.25000e+02  2.50000e+01 -5.00000e+00  1.00000e+00]
 [-3.93040e+01  1.15600e+01 -3.40000e+00  1.00000e+00]
 [-8.00000e+00  4.00000e+00 -2.00000e+00  1.00000e+00]
 [-5.12000e-01  6.40000e-01 -8.00000e-01  1.00000e+00]
 [ 0.00000e+00  0.00000e+00  0.00000e+00  1.00000e+00]
 [ 1.72800e+00  1.44000e+00  1.20000e+00  1.00000e+00]
 [ 1.56250e+01  6.25000e+00  2.50000e+00  1.00000e+00]
 [ 6.40000e+01  1.60000e+01  4.00000e+00  1.00000e+00]
 [ 1.25000e+02  2.50000e+01  5.00000e+00  1.00000e+00]
 [ 3.43000e+02  4.90000e+01  7.00000e+00  1.00000e+00]
 [ 6.14125e+02  7.22500e+01  8.50000e+00  1.00000e+00]]

using this code

for i in range(rowA):
A[i,0] = deepcopy ( A[i,2] ** 3 )

the numbers are ok, but this scientific form is killing me and I don't know how to get rid of it

I know I could use a different approach ( and I will most likely do) but I'd like to know what I'm doing wrong in this one

0 Answers0