[SciPy-dev] Physical Constants
Chuck.Harris at sdl.usu.edu
Thu Oct 3 16:21:27 CDT 2002
I had far too much time on my hands, so put all the CODATA physical constants
into a dictionary. I admit this doesn't save a whole lot of time over just
looking up the constants, but it does add some consistancy and self
>>> import PhysicalConstants as pc
>>> c = pc.value('speed of light in vacuum')
>>> print c
The module documentation is
""" Fundamental Physical Constants
These constants are taken from CODATA Recommended Values of the
Fundamental Physical Constants: 1998. They may be found at
physics.nist.gov/constants. The values are stored in the dictionary
physical_constants as a tuple containing the value, the units, and
the relative precision, in that order. All constants are in SI units
unless otherwise stated.
Several helper functions are provided:
value(key) returns the value of the physical constant.
unit(key) returns the units of the physical constant.
precision(key) returns the relative precision of the physical constant.
find(sub) prints out a list of keys containing the string sub.
I've attached the python file for anyone who is interested.
On a further note, I have some small routines for generating
permutations, mixed radix counters, and grey code counters. I find
these come in handy on occasion. Any takers?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 16739 bytes
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20021003/bf67ea59/attachment.obj
More information about the Scipy-dev