Asked By – Douglas B. Staple
In a project using SciPy and NumPy, should I use
Now we will see solution for issue: Should I use scipy.pi, numpy.pi, or math.pi?
>>> 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.