replaced some np.* math functions by simpler ones