Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/constants.py
diff options
context:
space:
mode:
authorReinier Heeres <reinier@heeres.eu>2008-12-23 21:50:32 (GMT)
committer Reinier Heeres <reinier@heeres.eu>2008-12-23 21:50:32 (GMT)
commit6807696129436dbf071b606300ce6dda2adb1c50 (patch)
tree984328276f12f6d18f89ea5ea4e940a379c3993f /constants.py
parentf0b95df2389c5686979b489fa5f2084fd3738edf (diff)
Move to more flexible and faster parser based on python AST
Diffstat (limited to 'constants.py')
-rw-r--r--constants.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/constants.py b/constants.py
new file mode 100644
index 0000000..f071ab3
--- /dev/null
+++ b/constants.py
@@ -0,0 +1,42 @@
+# constants.py, constants available in Calculate,
+# by Reinier Heeres <reinier@heeres.eu>
+# Most of these come from Wikipedia.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+import math as _math
+
+pi = _math.pi # 3.1415926535
+e = _math.exp(1) # 2.7182818284590451
+
+class math:
+ golden_ratio = 1.61803398874989484820458683436563811
+
+class physics:
+ c = 299792458 # Speed of light (in vacuum)
+ h = 6.6260689633e-34 # Planck's constant
+ hbar = 1.05457162853e-34 # Dirac's constant
+ mu0 = 4e-7 * pi # Magnetic permeability of vacuum
+ e0 = 8.854187817e-12 # Electric permeability of vacuum
+
+ Na = 6.022141510e23 # Avogadro's number
+ kb = 1.380650524e-23 # Boltmann's constant
+ R = 8.31447215 # Gas constant
+
+ c_e = -1.60217648740e-19 # Electron charge
+ m_e = 9.109382616e-31 # Electron mass
+ m_p = 1.6726217129e-27 # Proton mass
+ m_n = 1.6749272928e-27 # Neutron mass
+