Skip to content

Functions

The built-in functions, by group:

And all of them from A to Z:

FunctionWhat it does
absThe absolute value of x, or the magnitude of a complex number. Also written |x|.
acosThe angle whose cosine is x, between 0 and π.
acoshThe inverse hyperbolic cosine of x, for x of 1 or more.
acotThe angle whose cotangent is x, between 0 and π.
acothThe inverse hyperbolic cotangent of x, for x beyond −1 and 1.
acscThe angle whose cosecant is x.
argThe angle of z in the complex plane, between −π and π.
asecThe angle whose secant is x.
asinThe angle whose sine is x, between −π/2 and π/2.
asinhThe inverse hyperbolic sine of x.
atanThe angle whose tangent is x, between −π/2 and π/2.
atan2The angle of the point (x, y) from the x axis, between −π and π; x and y may have units, the same.
atanhThe inverse hyperbolic tangent of x, for x between −1 and 1.
augmentThe matrices side by side; they need the same number of rows.
CeilThe smallest multiple of y not below x.
ceilThe smallest integer not below x.
cellsA range of a named table’s grid, written as in a spreadsheet, the header being row 1.
CFFTAs cfft, scaled by 1/n and with the opposite sign in the exponent.
cfftThe Fourier transform of a complex vector or matrix of any size, scaled by 1/√n.
cnormThe probability that a standard normal variable is below x.
colsThe number of columns of A.
concatThe strings joined.
conjThe complex conjugate of z, element by element in an array.
corrThe correlation coefficient of the two vectors.
cosThe cosine of x.
coshThe hyperbolic cosine of x.
cotThe cotangent of x, 1/tan(x).
cothThe hyperbolic cotangent of x, 1/tanh(x).
crossThe cross product of the three-element vectors u and v.
cscThe cosecant of x, 1/sin(x).
cschThe hyperbolic cosecant of x, 1/sinh(x).
csortThe rows of A sorted by column j.
csplineA cubic spline through the points, with cubic ends, for interp.
diffThe derivative of f with respect to x (the nth derivative, up to 5) at x’s current value.
dnormThe probability density of the normal distribution at x.
eigenvalsThe eigenvalues of the square matrix M, as a column.
eigenvecThe eigenvector of M for the eigenvalue λ, of length 1.
eigenvecsThe eigenvectors of M, one per column, in the order of eigenvals(M), each of length 1.
erfThe error function.
erfcThe complementary error function, 1 − erf(x).
errorStops with the message s: in a program, for a value that can’t be used.
expe to the power x.
FFTAs fft, scaled by 1/n and with the opposite sign in the exponent.
fftThe Fourier transform of the real vector v (2ⁿ elements), its first half and the middle, scaled by 1/√n.
findBelow given, the values of the unknowns that satisfy its constraints, starting from their current values.
FloorThe largest multiple of y not above x; x and y may have units, the same.
floorThe largest integer not above x.
gammaThe gamma function, as Γ(x).
histHow many of the data fall in each interval: intervals is a vector of their ends, or the number of equal intervals.
histogramAs hist, beside the middle of each interval: a column of middles, then one of counts.
hlookupThe elements of row i of A in the columns whose first element is z.
ICFFTThe inverse of CFFT.
icfftThe inverse of cfft.
identityThe n×n identity matrix.
ifa if c is true (not zero), otherwise b; only the one chosen is evaluated.
IFFTThe inverse of FFT.
ifftThe inverse of fft: the real vector whose transform is c.
ImThe imaginary part of z.
intThe definite integral of f over x from a to b; either limit may be ∞.
interceptWhere the least-squares straight line crosses x = 0.
interpThe value at x of a spline from cspline, pspline or lspline, or of a polynomial from regress.
IsArray1 if x is an array, 0 if not.
IsScalar1 if x is a number, 0 if not.
IsString1 if x is a string, 0 if not.
lastThe index of the last element of v, counting from ORIGIN.
lengthThe number of elements of the vector v.
linfitThe least-squares coefficients of a sum of terms: F(x) returns a vector of the terms.
linspacen values evenly spaced from a to b, as a column.
linterpThe value at x of the straight lines between the points (vx, vy); beyond the ends, the end line carries on.
lnThe natural logarithm of x.
lnΓThe natural logarithm of the gamma function, for large x.
logThe logarithm of x to base 10, or to base b.
logspacen values from a to b, evenly spaced on a log scale.
lookupThe elements of B in the places where A holds z.
lsplineA cubic spline with straight ends (the natural spline), for interp.
matchThe positions in A of the value z, or with mode “near”, “lt”, “gt”, “leq” or “geq” of the nearest value, the one just below or just above.
matrixAn m×n matrix whose element (i, j) is f(i, j), i and j counting from 0.
maxThe largest of the numbers given, arrays included element by element.
MaximizeThe values of the variables where f(x, y, …) is greatest.
meanThe mean of all the numbers given.
medianThe median of all the numbers given.
minThe smallest of the numbers given.
minerrBelow given, the values that come closest to satisfying its constraints, when they can’t all hold.
MinimizeThe values of the variables, from their current values, where f(x, y, …) is least; below given, within its constraints.
modThe remainder of x divided by y, with the sign of x.
nthrootThe real nth root of x; an odd root of a negative number is negative.
num2strThe number x as a string.
OdesolveBelow given, the solution of its differential equation and initial conditions as a function of t, up to b.
pauseReturns x, for compatibility with imported sheets.
pnormThe probability that a normal variable is below x.
polyrootsThe roots of the polynomial v₀ + v₁x + v₂x² + …, as a column, complex where they are.
prodThe product of the elements of v, or of f over i. Also written with Π.
psplineA cubic spline with parabolic ends, for interp.
qnormThe x below which a normal variable falls with probability p.
ReThe real part of z.
READCSVA comma-separated file as a matrix, numbers and text kept apart.
READEXCELThe cells of an Excel workbook (.xlsx or .xls), all of its first sheet or a range; in the desktop app.
READFILEA data file, type being “delimited” (spaces, tabs or commas) or “csv”.
READPRNThe numbers in a text file, in columns separated by spaces, tabs or commas; lines that aren’t numbers are skipped.
regressThe least-squares polynomial of degree k through the points, for interp.
reverseThe elements of v in reverse order (the rows of a matrix).
RkadaptAs rkfixed, at the same n points, with adaptive steps between them for accuracy.
rkadaptThe same as Rkadapt.
rkfixedThe solution of y’ = D(x, y) from x1 to x2 in n equal steps (fourth-order Runge–Kutta): a column of x, then one per element of y.
rndA random number between 0 and x, the same at every recalculation.
rnormm random numbers from the normal distribution, as a column.
rootA value of x where f is zero: from x’s current value as a guess, or between a and b where f changes sign.
Roundx rounded to the nearest multiple of y.
roundx rounded to n decimal places, or to an integer.
rowsThe number of rows of A (0 for a number).
rsortThe columns of A sorted by row i.
runifm random numbers between a and b, as a column.
searchThe position of t in s, looking from position m, or −1 if it isn’t there.
secThe secant of x, 1/cos(x).
sechThe hyperbolic secant of x, 1/cosh(x).
sign−1, 0 or 1, as x is negative, zero or positive.
signumz divided by its magnitude, or 0 when z is 0.
sinThe sine of x, an angle in radians, or with a unit such as deg.
sinhThe hyperbolic sine of x.
SIUnitsOfOne of x’s unit in SI, so that x/SIUnitsOf(x) is the plain number.
slopeThe slope of the least-squares straight line through the points.
sortThe elements of v in ascending order.
sqrtThe square root of x, with its units halved.
stackThe matrices one above the other; they need the same number of columns.
StdevThe standard deviation of a sample.
stdevThe standard deviation of a whole population.
str2numThe number written in the string s.
strlenThe number of characters in s.
submatrixThe part of A from row ir to jr and column ic to jc, counting from ORIGIN.
substrn characters of s from position m (counting from 0).
sumThe sum of the elements of v, or of f over the range variable i, or over i from a to b. Also written with Σ.
tanThe tangent of x.
tanhThe hyperbolic tangent of x.
timeThe time now in seconds (z is not used), for timing a long calculation.
trThe trace of the square matrix M, the sum of its diagonal.
traceReturns x, for compatibility with imported sheets.
TruncThe multiple of y nearest x towards zero.
truncThe integer part of x, towards zero.
UnitsOfThe same as SIUnitsOf.
useThe functions of a Python file, as a module: bt := use "beam.py", then bt.f(x); in the desktop app.
VarThe variance of the numbers as a sample (dividing by n − 1).
varThe variance of the numbers as a whole population (dividing by n).
vecThe expression evaluated element by element over its arrays (the vectorize arrow).
vlookupThe elements of column j of A in the rows whose first element is z.
ΓThe gamma function: Γ(n) is (n − 1)! for a whole number n.