Expressions used in Data Arithmetic module, grain quantity formulas and in graph function fitting have syntax similar to common programming languages.

All numbers are real (floating point), number literals use standard notation. Examples of valid numbers: 1, .707, 2.661, 8.2e-34.

Function, constant, and variable names start with a letter and continue with zero or more letters, numbers, or underscores. Examples of valid identifiers: pow10 (a function), Pi (a constant), d2_2 (a variable).

The precedence of operations is summarized in following table.

function call and unary operatorsright to left-sqrt 3
power operatorright to left2^16
multiplication, division, and modulo operatorsleft to right9/2 * 8
addition and subtraction operatorsleft to right3 - 4 + 5

Note -3^2 is 9, that is (-3)^2, like in bc, but unlike in Perl or Python.

Available operators and functions are listed in following table.

+ (unary)no op
- (unary)negative value
~negative value (equivalent to -)
+ (binary)addition
- (binary)subtraction
%floating point modulo
absabsolute value
floorrounding down to nearest integer
ceilrounding up to nearest integer
sqrtsquare root
cbrtcubic root
sinsine function
coscosine function
tantangent function
asinarc sine function
acosarc cosine function
atanarc tangent function
sinccardinal sine function, sine divided by the value
expbase-e exponential function
lnbase-e logarithm function
logbase-e logarithm function
pow10base-10 exponential function
log10base-10 logarithm function
pow2base-2 exponential function
log2base-2 logarithm function
spowsigned power function; the result has the same sign as the argument
sinhhyperbolic sine function
coshhyperbolic cosine function
tanhhyperbolic tangent function
asinhinverse hyperbolic sine function
acoshinverse hyperbolic cosine function
atanhinverse hyperbolic tangent function
erferror function (integral of Gaussian from zero)
erfccomplementary error function (integral of Gaussian to infinity)
powpower function, pow(x,y) equals to x^y
minminimum of two values
maxmaximum of two values
stepzero for negative values or zero, one for positive values
modfloating point modulo, mod(x,y) equals to x % y
hypotEuclidean distance function, hypot(x,y) equals to sqrt(x^2+y^2)
atan2arc tangent function of two variables

The following functions are available if the system mathematical library provides them:

lGammalogarithm of Γ function
GammaΓ function
J0Bessel function of first kind and order 0
J1Bessel function of first kind and order 1
Y0Bessel function of second kind and order 0
Y1Bessel function of second kind and order 1

Beside that, there are a few peculiarities that may make typing simple expression easier:

If in doubt, write out expressions in full form.