If I ask Python for the cube power of 1963 I get:
In[1]: 1963**3
Out[1]: 7564163347
But if I define an array and ask numpy.power to return the cube powers I get:
In[1]: a=nu.array([1, 3, 5, 1963])
In[2]: nu.power(a)
Out[2]: array([1, 27, 125, -1025771245], dtype=int32)
Why is it returning some numbers correctly but not others? Do I need to mark all the numbers as float in the original array? Why does it have a problem with the array but not when I directly ask for the cube power (e.g. 1961**3)?
I noticed that this works:
In[1]: a=nu.array([1, 3, 5, 1963.0])
In[2]: nu.power(a)
Out[2]: array([1.00000000e+00, 2.70000000e+01, 1.25000000e+02, 7.56416335e+09])
Thanks!