Procedures Details <Prev Next>

Expressions

General mathematical expressions can be used in several contexts, such as expressing constraints in least squares fitting, and Custom Population Functions, Custom Width Functions, Custom Transition Functions, Lineshape Functions or Custom Lineshape Functions. Each context has some specific variables introduced, but the same logic is otherwise used for all expressions:

The following special functions and operators are also available:
int(a)
Integer part of a; number is closer to zero than a (or equal to a).
frac(a)
a - int(a)
%
modulus operator: a % b = frac(a/b)*b
mod(a,b)
a % b except if a < 0 in which case b-frac(|a|/b)*b is used.
a xor b
bitwise exclusive or of a and b
pi
3.14159...
min(a,b,c...)
The minimum value of all the arguments
max(a,b,c...) The maximum value of all the arguments
poly(x,a0,a1,a2...) a0+a1.x+a2.x2+...
lor(x,w)
Lorenztian function with FWHM w and unit area = w/[2π(x2+w2/4)]
gau(x,g)
Gaussian function with FWHM g and unit area = w½ exp(-w2x2) where w = 2ln(2)½/g
voigt(x,l,g)
Voigt profile at offset x from the line centre. l is the FWHM of the Lorenztian component, g of the Gaussian. The area is unity.
air(s)
Air wavelength/nm given vacuum wavenumber s/cm-1. The refractive index is taken from from B Edlen, Metrologia, 2, 71 (1966).
vac(l)
Vacuum wavenumber/cm-1 given air wavelength in nm.
atan2(x,y)
atan(x/y), but with a -π...π result range.
threej(j1,m1,j2,m2,j3,m3)
Wigner 3-j function
cg(j1,m1,j2,m2,j3,m3)
Clebsch-Gordan coefficient = (-1)j1-j2+m3(2j3+1)½threej(j1,m1,j2,m2,j3,-m3)
sixj(j1,j2,j3,j4,j5,j6)
Wigner 6-j function
ninej(j11,j12,j13,j21,j22,j23,j31,j32,j33)
Wigner 9-j function

Selected fundamental constants (in SI units) are available in many contexts, though not all to avoid confusion:
a0
Bohr radius/m
c
Speed of light
ee
Charge on the electron
ep
Permittivity of a vacuum
ge
g value for an electron
gg
Gravitational Constant
f
Faraday Constant
k
Boltzmann Constant
l
Avogadro's Number
r
Gas Constant
h
Planck constant
hc
h/2π
me
mass of electron
mn
mass of neutron
mp
mass of proton
mub
Bohr magneton
mun
nuclear magneton
rydberg
Rydberg constant/m-1
u
Atomic mass unit/kg

See also:

Debugging

A nDebug flag is available in each object that uses an expression. If non zero, that the values of all the variables and the value of the function on each evaluation will be written to the log window. The value specifies the number of times this is done; use View, Clear Cache to reset the count if necessary. Negative values have special interpretation: