Is there a difference between scipy.pi, numpy.pi, or math.pi?

math, numpy, pi, python, scipy

Solution

>>> import math
>>> import numpy as np
>>> import scipy
>>> math.pi == np.pi == scipy.pi
True

So it doesn't matter, they are all the same value.

The only reason all three modules provide a `pi` value is so if you are using just one of the three modules, you can conveniently have access to pi without having to import another module. They're not providing different values for pi.

Problem

In a project using SciPy and NumPy, when should one use `scipy.pi` vs `numpy.pi` vs just `math.pi`? Is there a difference between these values?

Original source