Should probably use numpy, instead of math.