Switch numpy with math