constants.scm 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. #| -*-Scheme-*-
  2. Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
  3. 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  4. 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Massachusetts
  5. Institute of Technology
  6. This file is part of MIT/GNU Scheme.
  7. MIT/GNU Scheme is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11. MIT/GNU Scheme is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with MIT/GNU Scheme; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
  18. USA.
  19. |#
  20. ;;;; Numerical constants
  21. (define-constant ':pi "\\pi" "Pi"
  22. (* 4 (atan 1 1))
  23. &unitless)
  24. (define-constant ':2pi "2\\pi" "2*Pi"
  25. (* 8 (atan 1 1))
  26. &unitless)
  27. (define-constant ':pi/2 "\\pi/2" "Pi/2"
  28. (* 2 (atan 1 1))
  29. &unitless)
  30. (define-constant ':pi/4 "\\pi/4" "Pi/4"
  31. (atan 1 1)
  32. &unitless)
  33. (define-constant ':pi/3 "\\pi/3" "Pi/3"
  34. (* 4/3 (atan 1 1))
  35. &unitless)
  36. (define-constant ':pi/6 "\\pi/6" "Pi/6"
  37. (* 2/3 (atan 1 1))
  38. &unitless)
  39. (define-constant ':-pi "-\\pi" "-Pi"
  40. (* -4 (atan 1 1))
  41. &unitless)
  42. (define-constant ':-2pi "-2\\pi" "-2*Pi"
  43. (* -8 (atan 1 1))
  44. &unitless)
  45. (define-constant ':-pi/2 "-\\pi/2" "-Pi/2"
  46. (* -2 (atan 1 1))
  47. &unitless)
  48. (define-constant ':-pi/4 "-\\pi/4" "-Pi/4"
  49. (- (atan 1 1))
  50. &unitless)
  51. (define-constant ':-pi/3 "-\\pi/3" "-Pi/3"
  52. (* -4/3 (atan 1 1))
  53. &unitless)
  54. (define-constant ':-pi/6 "-\\pi/6" "-Pi/6"
  55. (* -2/3 (atan 1 1))
  56. &unitless)
  57. (define-constant ':+pi "+\\pi" "+Pi"
  58. (* +4 (atan 1 1))
  59. &unitless)
  60. (define-constant ':+2pi "+2\\pi" "+2*Pi"
  61. (* +8 (atan 1 1))
  62. &unitless)
  63. (define-constant ':+pi/2 "+\\pi/2" "+Pi/2"
  64. (* +2 (atan 1 1))
  65. &unitless)
  66. (define-constant ':+pi/4 "+\\pi/4" "+Pi/4"
  67. (+ (atan 1 1))
  68. &unitless)
  69. (define-constant ':+pi/3 "+\\pi/3" "+Pi/3"
  70. (* +4/3 (atan 1 1))
  71. &unitless)
  72. (define-constant ':+pi/6 "+\\pi/6" "+Pi/6"
  73. (* +2/3 (atan 1 1))
  74. &unitless)
  75. (define-constant ':gamma "\\gamma" "Euler-Macheroni-constant"
  76. 0.57721566490153286060651209008240243104215933593992
  77. &unitless)
  78. ;;;; Universal Physical Constants
  79. (define-constant ':c "c" "speed of light"
  80. 2.99792458e8
  81. (/ &meter &second))
  82. #|
  83. ;;; (1986)
  84. (define-constant ':G "G" "gravitational constant"
  85. 6.67259e-11
  86. (/ (* &newton (square &meter)) (square &kilogram))
  87. 128e-6)
  88. |# ;relative error
  89. ;;; CODATA 2006
  90. (define-constant ':G "G" "gravitational constant"
  91. 6.67428e-11
  92. (/ (* &newton (square &meter)) (square &kilogram))
  93. 1.0e-4)
  94. ;;; CODATA 2006
  95. (define-constant ':e "e" "elementary charge"
  96. 1.602176487e-19
  97. &coulomb
  98. 2.5e-8)
  99. ;;; CODATA 2006
  100. (define-constant ':h "h" "Planck constant"
  101. 6.62606896e-34
  102. (* &joule &second)
  103. 5.0e-8)
  104. ;;; CODATA 2006
  105. (define-constant ':N_A "N_A" "Avogadaro constant"
  106. 6.02214179e23
  107. (/ &unitless &mole)
  108. 5.0e-8)
  109. ;;; CODATA 2002
  110. (define-constant ':m_e "m_e" "electron mass"
  111. 9.1093826e-31
  112. &kilogram
  113. 1.7e-7)
  114. ;;; CODATA 2002
  115. (define-constant ':m_p "m_p" "proton mass"
  116. 1.67262171e-27
  117. &kilogram
  118. 1.7e-7)
  119. ;;; CODATA 2002
  120. (define-constant ':m_n "m_n" "neutron mass"
  121. 1.67492728e-27
  122. &kilogram
  123. 1.7e-7)
  124. ;;; CODATA 2002
  125. (define-constant ':m_u "m_u" "atomic mass unit"
  126. 1.66053886e-27
  127. &kilogram
  128. 1.7e-7)
  129. ;;; CODATA 2002
  130. (define-constant ':mu_e "\\mu_e" "electron magnetic moment"
  131. -9.28476412e-24
  132. (/ &joule &tesla)
  133. 8.6e-8)
  134. ;;; CODATA 2002
  135. (define-constant ':mu_p "\\mu_p" "proton magnetic moment"
  136. 1.41060671e-26
  137. (/ &joule &tesla)
  138. 8.7e-8)
  139. ;;; CODATA 2002
  140. (define-constant ':gamma_p "\\gamma_p" "proton gyromagnetic ratio"
  141. 2.67522205e8
  142. (/ &radian (* &tesla &second))
  143. 8.6e-8)
  144. (define-constant ':R_H "R_H" "quantum Hall resistance"
  145. 25812.8056
  146. &ohm
  147. 0.045e-6)
  148. (define-constant ':R "R" "molar gas constant"
  149. 8.314510
  150. (/ &joule (* &mole &kelvin))
  151. 8.4e-6)
  152. ;;; CODATA 2002
  153. (define-constant ':k "k" "Boltzmann constant"
  154. 1.3806505e-23
  155. (/ &joule &kelvin)
  156. 1.8e-6)
  157. ;;; The following are derived. Units must check.
  158. (define-constant ':h-bar "\\hbar" "Planck constant"
  159. (/ :h (* 2 :pi))
  160. (* &joule &second))
  161. (define-constant ':F "F" "Faraday constant"
  162. (* :N_A :e)
  163. (/ &coulomb &mole)
  164. 0.30e-6)
  165. (define-constant ':mu_0 "\\mu_0" "permeability of free space"
  166. (* 4e-7 :pi)
  167. (/ &henry &meter))
  168. (define-constant ':epsilon_0 "\\epsilon_0" "permittivity of free space"
  169. (/ 1
  170. (* :mu_0 (square :c)))
  171. (/ &farad &meter))
  172. (define-constant ':Z0 "Z_0" "impedance of free space"
  173. (* :mu_0 :c)
  174. &ohm)
  175. (define-constant ':alpha "\\alpha" "fine structure constant"
  176. (* (/ 1 (* 4 :pi :epsilon_0))
  177. (/ (square :e) (* :h-bar :c)))
  178. &unitless)
  179. (define-constant ':R_infinity "R_\\inf" "Rydberg constant"
  180. (/ (* :m_e :c (square :alpha))
  181. (* 2 :h))
  182. (/ &unitless &meter)
  183. 0.0012e-6)
  184. (define-constant ':r_e "r_e" "classical electron radius"
  185. (* (/ :h-bar (* :m_e :c)) :alpha)
  186. &meter
  187. 0.013e-6)
  188. (define-constant ':lambda_C "\\lambda_C" "electron Compton wavelength"
  189. (/ :h (* :m_e :c))
  190. &meter
  191. 0.089e-6)
  192. (define-constant ':a_0 "a_0" "Bohr radius"
  193. (/ :r_e (square :alpha))
  194. &meter
  195. 0.045e-6)
  196. (define-constant ':Phi_0 "\\Phi_0" "magnetic flux quantum"
  197. (/ :h (* 2 :e))
  198. &weber
  199. 0.30e-6)
  200. (define-constant ':h/2m_e "h/(2m_e)" "quantum of circulation"
  201. (/ :h (* 2 :m_e))
  202. (/ (square &meter) &second)
  203. 0.089e-6)
  204. (define-constant ':e/m_e "e/m_e" "specific electron charge"
  205. (/ (- :e) :m_e)
  206. (/ &coulomb &kilogram)
  207. 0.30e-6)
  208. (define-constant ':mu_B "\\mu_B" "Bohr magneton"
  209. (/ (* :e :h-bar) (* 2 :m_e))
  210. (/ &joule &tesla)
  211. 0.34e-6)
  212. (define-constant ':mu_e/mu_B "\\mu_e/\\mu_B" "electron magnetic moment ratio"
  213. (/ :mu_e :mu_B)
  214. &unitless
  215. 1e-11)
  216. (define-constant ':mu_N "\\mu_N" "nuclear magneton"
  217. (/ (* :e :h-bar) (* 2 :m_p))
  218. (/ &joule &tesla)
  219. 0.34e-6)
  220. (define-constant ':sigma "\\sigma" "Stefan-Boltzmann constant"
  221. (* (/ (square :pi) 60)
  222. (/ (expt :k 4)
  223. (* (expt :h-bar 3) (expt :c 2))))
  224. (/ &watt (* (square &meter) (expt &kelvin 4)))
  225. 34.0e-6)
  226. (define-constant ':sigma_T "\\sigma_T" "Thomson cross section"
  227. (* 8/3 :pi (square :r_e))
  228. (square &meter))
  229. ;;;; Observed and measured numbers
  230. (define background-temperature ;Cobe 1994
  231. (& 2.726 &kelvin)) ;+-.005 Kelvin
  232. ;;; Thermodynamic
  233. (define water-freezing-temperature
  234. (& 273.15 &kelvin))
  235. (define room-temperature
  236. (& 300.00 &kelvin))
  237. (define water-boiling-temperature
  238. (& 373.15 &kelvin))
  239. ;;; Earth
  240. (define earth-orbital-velocity
  241. (& 29.8e3 (/ &meter &second)))
  242. (define earth-mass
  243. (& 5.976e24 &kilogram))
  244. (define earth-radius
  245. (& 6371e3 &meter))
  246. (define earth-surface-area
  247. (& 5.101e14 (expt &meter 2)))
  248. (define earth-escape-velocity
  249. (& 11.2e3 (/ &meter &second)))
  250. (define earth-gravitational-acceleration
  251. (& 9.80665 (/ &meter (expt &second 2))))
  252. (define :g
  253. earth-gravitational-acceleration)
  254. (define earth-mean-density
  255. (& 5.52e3 (/ &kilogram (expt &meter 3))))
  256. ;;; This is the average amount of
  257. ;;; sunlight available at Earth on an
  258. ;;; element of surface normal to a
  259. ;;; radius from the sun. The actual
  260. ;;; power at the surface of the earth,
  261. ;;; for a panel in full sunlight, is
  262. ;;; not very different, because, in
  263. ;;; absence of clouds the atmosphere
  264. ;;; is quite transparent. The number
  265. ;;; differs from the obvious geometric
  266. ;;; number
  267. ;;; (/ sun-luminosity (* 4 :pi (square m/AU)))
  268. ;;; ;Value: 1360.454914748201
  269. ;;; because of the eccentricity of the
  270. ;;; Earth's orbit.
  271. (define earth-incident-sunlight
  272. (& 1370. (/ &watt (expt &meter 2))))
  273. (define vol@stp
  274. (& 2.24136e-2 (/ (expt &meter 3) &mole)))
  275. (define sound-speed@stp ;c_s
  276. (& 331.45 (/ &meter &second)))
  277. (define pressure@stp
  278. (& 101.325e3 &pascal))
  279. (define earth-surface-temperature
  280. (+ (& 15 &kelvin)
  281. water-freezing-temperature))
  282. ;;; Sun
  283. (define sun-mass
  284. (& 1.989e30 &kilogram))
  285. (define :m_sun sun-mass)
  286. (define sun-radius
  287. (& 6.9599e8 &meter))
  288. (define :r_sun sun-radius)
  289. (define sun-luminosity
  290. (& 3.826e26 &watt))
  291. (define :l_sun sun-luminosity)
  292. (define sun-surface-temperature
  293. (& 5770.0 &kelvin))
  294. (define sun-rotation-period
  295. (& 2.14e6 &second))
  296. ;;; The Gaussian constant
  297. (define GMsun ;=(* gravitational-constant sun-mass)
  298. (& 1.32712497e20
  299. (/ (* &newton (expt &meter 2)) &kilogram)))