Can't understand this simple matrix multiplication in python Ok guys, I might be very tired here, but I can't figure out why this matrix multiplication by a scalar gives the following result (python)


  Matrix named 'dx'
        [ 1.6,  3.6,  0.4, 14.4, 25.6],
        [10. , 10. ,  0.4, 14.4,  3.6],
        [ 0.4,  0. ,  0. ,  1.6, 10. ],
        [ 6.4,  0. ,  3.6,  1.6,  0.4],
        [14.4,  0. , 25.6,  0.4,  6.4]
  
  10 * dx, in python, gives 
        [ -40.,  -60.,  -20., -120., -160.],
        [-100., -100.,  -20., -120.,  -60.],
        [ -20.,    0.,    0.,  -40., -100.],
        [ -80.,    0.,  -60.,  -40.,  -20.],
        [-120.,    0., -160.,  -20.,  -80.]


From what I understand, each member should be multiplicated by 10, but it's clearly not the case.

I'm using Python 3.6 &amp; numpy

What Am I missing ? 
Link to matrix multiplication by scalar , pretty basic stuff :
http://www.purplemath.com/modules/mtrxmult.htm

Thanks !
It works for me.

&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; dx = np.matrix([[ 1.6, 3.6, 0.4, 14.4, 25.6],
... [10. , 10. , 0.4, 14.4, 3.6],
... [ 0.4, 0. , 0. , 1.6, 10. ],
... [ 6.4, 0. , 3.6, 1.6, 0.4],
... [14.4, 0. , 25.6, 0.4, 6.4]])
&gt;&gt;&gt; 10 * dx
matrix([[  16.,   36.,    4.,  144.,  256.],
        [ 100.,  100.,    4.,  144.,   36.],
        [   4.,    0.,    0.,   16.,  100.],
        [  64.,    0.,   36.,   16.,    4.],
        [ 144.,    0.,  256.,    4.,   64.]])


You might want to check if you have redefined dx before the multiplication.