I compare two arrays interactively in iPython, the returns are correct:
In[143]: r=np.array([0.,0.04166667, 0.08333333, 0.125, 0.16666667 , 0.20833333 , 0.25, 0.29166667 , 0.33333333 , 0.375, 0.41666667,0.45833333 , 0.5, 0.54166667, 0.58333333 , 0.625, 0.66666667 , 0.70833333 , 0.75, 0.79166667, 0.83333333, 0.875, 0.91666667, 0.95833333])
In[144]: c=np.array([ 0., 0.04166667, 0., 0., 0., 0.20833333, 0., 0.29166667 , 0., 0. , 0., 0.45833333, 0., 0.54166667, 0. , 0. , 0.,0.70833333, 0. , 0.79166667 , 0., 0., 0., 0.95833333]) In [145]: c==r Out[145]: array([ True, True, False, False, False, True, False, True, False, False, False, True, False, True, False, False, False, True, False, True, False, False, False, True], dtype=bool
)
But in a python program in the 'same' setting, the results are not correct:
turns=1
r = np.linspace(1/24, turns, 24*turns,endpoint=False)
rr=r%1
c=np.array([0.,0.04166667,0,0,0,0.20833333,0,0.29166667,0,0,0,0.45833333,
0,0.54166667,0,0,0,0.70833333,0,0.79166667,0,0,0,0.95833333])
cc=np.tile(c,turns)
print([rr==cc])
The result is different:
[array([ True, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False], dtype=bool)]
What mistake did I made? Your help is appreciated.