Built-in Constants

We received several requests to provide easier access to various constants from within IGOR. Although we have not determined how this will be implemented, e.g., include files, tables in the help or some built-in function, we need to compile a list of the constants that are most commonly used by the IGOR community. To help us construct this list please tell us which constants you find useful. Here is an example:

for example:

Common name: Euler-Mascheroni gamma
Suggested name: kGammaEuler
Value: 0.5772156649015328606065
Units: None
Reference: http://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant


Please respond by posting to this thread so that everyone can see the list as it is being compiled.

A.G.
WaveMetrics, Inc.
Here are several I use in plasma physics. NIST is, in general, the definitive reference for these physical constants.

Common Name: Magnetic Constant \mu_0
Suggested Name: kMu0
Value: (Pi * 4e-7) [exact]
Units: N / (A^2)
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?mu0|search_for=universal_in!

Common Name: Electric Constant \epsilon_0
Suggested Name: kEpsilon0
Value: 8.854 187 817... x 10-12 [exact]
Units: F/m
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?ep0#mid

Common Name: elementary charge e
Suggested Name: kqe
Value: 1.602 176 487 x 10-19
Units: C
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?e|search_for=elecmag_in!
Common name: mass of neutron
Suggested name: kmassneutron
Value:1.674 927 211e-27
Units: kg
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?mn

Common name: mass of proton
Suggested name: kmassproton
Value:1.672 621 637e-26
Units: kg
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?mp

Common name: Plancks Constant
Suggested name: kPlanck
Value:6.626 068 96e-34
Units: Js
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?mp

Common name: Speed of light in vacuum
Suggested name: kLightSpeed
Value:299 792 45
Units: m/s
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?c

Common name: Avogadro
Suggested name: kAvogadro
Value:6.022 141 79e23
Units:
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?c

Common Name: Plancks constant divided by mass of neutron
Suggested name: kPlanckOverMassNeutron
Value:6.626e-34/1.674927211e-27
Units: Js/kg
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?c

Common Name: classical electron radius
Suggested name: kElectronRadius
Value:2.817 940 2894 e-15
Units: m
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?re|search_for=Classical+elect…


Also need Boltzmann, ideal gas constant, etc

For ease of importing check out:
http://physics.nist.gov/cuu/Constants/Table/allascii.txt

I vote for static constants in an includable procedure file, accessible by a module name. Or by a function e.g. PhysConstant(0|1|3|4, etc)
Jonathan Gutow
Professor of Chemistry
University of Wisconsin Oshkosh
http://www.uwosh.edu/facstaff/gutow

Rather than list the ones I use most commonly, I would also second including the list from the NIST standards site. I periodically import an update of this for my own use. Unfortunately this text listing does not include common symbols.

http://physics.nist.gov/cuu/Constants/Table/allascii.txt

If you go to the following page and select "table (pdf)" and then click on the button for "Extensive listings" you will get a .pdf file with all the constants and their preferred symbols. I recommend these be translated as follows:

Xy would be translated to an Igor constant name as X_y. Infinity symbols could be two little o's next to each other as in R_oo.

The link is: http://physics.nist.gov/cuu/Constants/index.html

I recommend this as an optional package with some sort of easy table to select constant names from. Maybe have them appear in a popup in the "Compose Expression" dialog.

My two cents.
Jonathan
I think including constants into igor would be a very useful addition. However, physical constants are only meaningful with the units they come with, which brings up a related subject. Is there a plan to have igor handle units as well and, if so, being able to convert units into each other? This would make storing constants even more useful when expressions can be calculated and expressed in any given unit (that's known to igor), allowing mixing of units for the same quantity (e.g. a height in feet multiplied by an area in acres and expressing the result in cubic meters). I think that having units stored in igor as another sets of constants that refer to a basic set of units (for example SI units, as found on http://physics.nist.gov/cuu/Units/units.html) would make such conversions possible. I personally make many of my numerical mistakes by not converting units correctly and would appreciate automation of that greatly.
Harald Stark
andyfaff wrote:

Common name: Avogadro
Suggested name: kAvogadro
Value:6.022 141 79e23
Units:
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?c

I vote for static constants in an includable procedure file, accessible by a module name. Or by a function e.g. PhysConstant(0|1|3|4, etc)



Mac's comment: "Better, Newer" value in the wikipedia link above - difference is 0.000 001 01e23

I like the includable procedures file idea as well
Here are the particular constants that I generally use. I am also have an igor routine that will get the constants from the nist web site or from a local file. It can also update the local file from the web. I will try to attach it to this message.

The earlier comment about units is appropriate. I do not have a good solution, but for the mac users, There is a very nice unit converter dashboard widget that understands mass energy-mass equivalence and atomic units at http://www.cberthod.homepage.bluewin.ch/vuc/widget.html
It even knows that c = 9.7156e-21 parsec/ps!


Common name: Si lattice parameter
Suggested name: aSi_A
Value:5.43102064
Units: Angstrom
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?asil

Common name: hc in keV Angstroms
Suggested name: hc_keVA
Value:12.39841856
Units: keV Angstrom
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?hev, http://physics.nist.gov/cgi-bin/cuu/Value?c

Common name: hc in keV nm
Suggested name: hc_keVA
Value:1.239841856
Units: keV nm
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?hev, http://physics.nist.gov/cgi-bin/cuu/Value?c

Common name: Thomson radius
Suggested name: re_m
Value:2.8179402894e-15
Units: m
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?sigmae, sigmae = 8*PI/3 * re^2

Common name: Thomson radius
Suggested name: re_A
Value:2.8179402894e-5
Units: Angstrom
Reference: http://physics.nist.gov/cgi-bin/cuu/Value?sigmae, sigmae = 8*PI/3 * re^2
PhysicalConstants.ipf (10.26 KB)
Values: all scientific (natural constants)
Nomenclature ... see below
Units: SI

Values: all atomic masses
Nomenclature ... see below
Units: g/mol

Proper implementation of the constants is a by far a more important factor for me. I personally would like access to the constants through (user-immutable -- they cannot muck them up on their own) structures, as below.

#include "Scientific Constants"  // WaveMetrics Provided
#include "Atomic Masses"  // WaveMetrics Provided

Function IdealGasCalc(n,ToC,V)
   variable n, ToC, V

   STRUCTURE ScientificConstants SC

   variable T = ToC + SC.TK0C.value   // SC.TK0C.value --> 273.15

   return (n*SC.Rg.value*T/V)  // you could also then have SC.Rg.units return the string units for the value
end

p1moleat25C1m3 = IdealGasCalc(1,25,1)

Function MolarMassCalc(elements,coef)
    wave/T elements
    wave coef

    STRUCTURE AtomicMasses AM

    variable ic, nt, itsM = 0
    nt = ItemsInList(elements)

    for (ic=0;ic<nt;ic+=1)
         itsM += coef[ic]*AM.$(elements[ic]).value  // this nomenclature is supposed to access the proper sub-member
    endfor

   return itsM
end

M_methane = MolarMassCalc("C;H;",{1,4})


Having a functional way for users to be able to translate ASCII (tab-delimited, XML ....) tables of constants into immutable "#include" structures (containing symbol, value, unit layouts) and check for existence of terms would be a big help ...

#include "Materials Properties" // User Generated
#include "Crystallography"  // User Generated

Function Strain(stress,mtrl)
     variable stress
     string mtrl

     STRUCTURE MaterialsProperties MP

     if (existsTerm(MP.$(mtrl))==0))
         DoAlert "Your material is not in the database"
         return 0
     endif

     return (stress/MP.$(mtrl).E)
end

Function CubicUnitCellVolume(mtrl)
    string mtrl

    STRUCTURE CubicLatticeParameters LP

     if (existsTerm(LP.$(mtrl))==0))
         DoAlert "Your material is not in the database of cubic materials"
         return 0
     endif
   
     return (LP.$(mtrl).ao.value^3)
end


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville