Does anybody know where within scipy (or its associated packages) pi and e are defined? Also, are any other constants predefined? I'm thinking of adding a few others to the list but don't want to duplicate effort if its already done and would like to keep everything in one place. -- R. Padraic Springuel
"R" == R Padraic Springuel <rspringuel@smcvt.edu> writes:
R> Does anybody know where within scipy (or its associated R> packages) pi and e are defined? Also, are any other constants R> predefined? I'm thinking of adding a few others to the list R> but don't want to duplicate effort if its already done and R> would like to keep everything in one place.
from scipy import pi, e pi 3.1415926535897931 e 2.7182818284590451
"RPS" == R Padraic Springuel <rspringuel@smcvt.edu> writes:
RPS> Does anybody know where within scipy (or its associated RPS> packages) pi and e are defined? Also, are any other RPS> constants predefined? I'm thinking of adding a few others to RPS> the list but don't want to duplicate effort if its already RPS> done and would like to keep everything in one place. Both Numeric/numarray and the math modules define e and pi. python -c "import Numeric; print Numeric.e, Numeric.pi" python -c "import math; print math.e, math.pi" cheers, prabhu
R. Padraic Springuel wrote:
Does anybody know where within scipy (or its associated packages) pi and e are defined? Also, are any other constants predefined? I'm thinking of adding a few others to the list but don't want to duplicate effort if its already done and would like to keep everything in one place.
As other people mentioned, pi and e are defined in Numeric, numarray, and math. As for adding new constants, I think a new file, scipy_base/constants.py, would be a good place for them. I'd rather not pollute the global namespace (i.e. what you get when you "from scipy import *") with more constants, though. -- Robert Kern rkern@ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter
Robert Kern wrote:
R. Padraic Springuel wrote:
Does anybody know where within scipy (or its associated packages) pi and e are defined? Also, are any other constants predefined? I'm thinking of adding a few others to the list but don't want to duplicate effort if its already done and would like to keep everything in one place.
As other people mentioned, pi and e are defined in Numeric, numarray, and math. As for adding new constants, I think a new file, scipy_base/constants.py, would be a good place for them. I'd rather not pollute the global namespace (i.e. what you get when you "from scipy import *") with more constants, though.
Agreed.
participants (5)
-
John Hunter -
Prabhu Ramachandran -
R. Padraic Springuel -
Robert Kern -
Travis Oliphant