Functions
The built-in functions, by group:
- Numbers and rounding
- Trigonometry
- Arrays
- Sums, calculus and solving
- Statistics and data
- Strings, units and programs
And all of them from A to Z:
| Function | What it does |
|---|---|
abs | The absolute value of x, or the magnitude of a complex number. Also written |x|. |
acos | The angle whose cosine is x, between 0 and π. |
acosh | The inverse hyperbolic cosine of x, for x of 1 or more. |
acot | The angle whose cotangent is x, between 0 and π. |
acoth | The inverse hyperbolic cotangent of x, for x beyond −1 and 1. |
acsc | The angle whose cosecant is x. |
arg | The angle of z in the complex plane, between −π and π. |
asec | The angle whose secant is x. |
asin | The angle whose sine is x, between −π/2 and π/2. |
asinh | The inverse hyperbolic sine of x. |
atan | The angle whose tangent is x, between −π/2 and π/2. |
atan2 | The angle of the point (x, y) from the x axis, between −π and π; x and y may have units, the same. |
atanh | The inverse hyperbolic tangent of x, for x between −1 and 1. |
augment | The matrices side by side; they need the same number of rows. |
Ceil | The smallest multiple of y not below x. |
ceil | The smallest integer not below x. |
cells | A range of a named table’s grid, written as in a spreadsheet, the header being row 1. |
CFFT | As cfft, scaled by 1/n and with the opposite sign in the exponent. |
cfft | The Fourier transform of a complex vector or matrix of any size, scaled by 1/√n. |
cnorm | The probability that a standard normal variable is below x. |
cols | The number of columns of A. |
concat | The strings joined. |
conj | The complex conjugate of z, element by element in an array. |
corr | The correlation coefficient of the two vectors. |
cos | The cosine of x. |
cosh | The hyperbolic cosine of x. |
cot | The cotangent of x, 1/tan(x). |
coth | The hyperbolic cotangent of x, 1/tanh(x). |
cross | The cross product of the three-element vectors u and v. |
csc | The cosecant of x, 1/sin(x). |
csch | The hyperbolic cosecant of x, 1/sinh(x). |
csort | The rows of A sorted by column j. |
cspline | A cubic spline through the points, with cubic ends, for interp. |
diff | The derivative of f with respect to x (the nth derivative, up to 5) at x’s current value. |
dnorm | The probability density of the normal distribution at x. |
eigenvals | The eigenvalues of the square matrix M, as a column. |
eigenvec | The eigenvector of M for the eigenvalue λ, of length 1. |
eigenvecs | The eigenvectors of M, one per column, in the order of eigenvals(M), each of length 1. |
erf | The error function. |
erfc | The complementary error function, 1 − erf(x). |
error | Stops with the message s: in a program, for a value that can’t be used. |
exp | e to the power x. |
FFT | As fft, scaled by 1/n and with the opposite sign in the exponent. |
fft | The Fourier transform of the real vector v (2ⁿ elements), its first half and the middle, scaled by 1/√n. |
find | Below given, the values of the unknowns that satisfy its constraints, starting from their current values. |
Floor | The largest multiple of y not above x; x and y may have units, the same. |
floor | The largest integer not above x. |
gamma | The gamma function, as Γ(x). |
hist | How many of the data fall in each interval: intervals is a vector of their ends, or the number of equal intervals. |
histogram | As hist, beside the middle of each interval: a column of middles, then one of counts. |
hlookup | The elements of row i of A in the columns whose first element is z. |
ICFFT | The inverse of CFFT. |
icfft | The inverse of cfft. |
identity | The n×n identity matrix. |
if | a if c is true (not zero), otherwise b; only the one chosen is evaluated. |
IFFT | The inverse of FFT. |
ifft | The inverse of fft: the real vector whose transform is c. |
Im | The imaginary part of z. |
int | The definite integral of f over x from a to b; either limit may be ∞. |
intercept | Where the least-squares straight line crosses x = 0. |
interp | The value at x of a spline from cspline, pspline or lspline, or of a polynomial from regress. |
IsArray | 1 if x is an array, 0 if not. |
IsScalar | 1 if x is a number, 0 if not. |
IsString | 1 if x is a string, 0 if not. |
last | The index of the last element of v, counting from ORIGIN. |
length | The number of elements of the vector v. |
linfit | The least-squares coefficients of a sum of terms: F(x) returns a vector of the terms. |
linspace | n values evenly spaced from a to b, as a column. |
linterp | The value at x of the straight lines between the points (vx, vy); beyond the ends, the end line carries on. |
ln | The natural logarithm of x. |
lnΓ | The natural logarithm of the gamma function, for large x. |
log | The logarithm of x to base 10, or to base b. |
logspace | n values from a to b, evenly spaced on a log scale. |
lookup | The elements of B in the places where A holds z. |
lspline | A cubic spline with straight ends (the natural spline), for interp. |
match | The 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. |
matrix | An m×n matrix whose element (i, j) is f(i, j), i and j counting from 0. |
max | The largest of the numbers given, arrays included element by element. |
Maximize | The values of the variables where f(x, y, …) is greatest. |
mean | The mean of all the numbers given. |
median | The median of all the numbers given. |
min | The smallest of the numbers given. |
minerr | Below given, the values that come closest to satisfying its constraints, when they can’t all hold. |
Minimize | The values of the variables, from their current values, where f(x, y, …) is least; below given, within its constraints. |
mod | The remainder of x divided by y, with the sign of x. |
nthroot | The real nth root of x; an odd root of a negative number is negative. |
num2str | The number x as a string. |
Odesolve | Below given, the solution of its differential equation and initial conditions as a function of t, up to b. |
pause | Returns x, for compatibility with imported sheets. |
pnorm | The probability that a normal variable is below x. |
polyroots | The roots of the polynomial v₀ + v₁x + v₂x² + …, as a column, complex where they are. |
prod | The product of the elements of v, or of f over i. Also written with Π. |
pspline | A cubic spline with parabolic ends, for interp. |
qnorm | The x below which a normal variable falls with probability p. |
Re | The real part of z. |
READCSV | A comma-separated file as a matrix, numbers and text kept apart. |
READEXCEL | The cells of an Excel workbook (.xlsx or .xls), all of its first sheet or a range; in the desktop app. |
READFILE | A data file, type being “delimited” (spaces, tabs or commas) or “csv”. |
READPRN | The numbers in a text file, in columns separated by spaces, tabs or commas; lines that aren’t numbers are skipped. |
regress | The least-squares polynomial of degree k through the points, for interp. |
reverse | The elements of v in reverse order (the rows of a matrix). |
Rkadapt | As rkfixed, at the same n points, with adaptive steps between them for accuracy. |
rkadapt | The same as Rkadapt. |
rkfixed | The 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. |
rnd | A random number between 0 and x, the same at every recalculation. |
rnorm | m random numbers from the normal distribution, as a column. |
root | A value of x where f is zero: from x’s current value as a guess, or between a and b where f changes sign. |
Round | x rounded to the nearest multiple of y. |
round | x rounded to n decimal places, or to an integer. |
rows | The number of rows of A (0 for a number). |
rsort | The columns of A sorted by row i. |
runif | m random numbers between a and b, as a column. |
search | The position of t in s, looking from position m, or −1 if it isn’t there. |
sec | The secant of x, 1/cos(x). |
sech | The hyperbolic secant of x, 1/cosh(x). |
sign | −1, 0 or 1, as x is negative, zero or positive. |
signum | z divided by its magnitude, or 0 when z is 0. |
sin | The sine of x, an angle in radians, or with a unit such as deg. |
sinh | The hyperbolic sine of x. |
SIUnitsOf | One of x’s unit in SI, so that x/SIUnitsOf(x) is the plain number. |
slope | The slope of the least-squares straight line through the points. |
sort | The elements of v in ascending order. |
sqrt | The square root of x, with its units halved. |
stack | The matrices one above the other; they need the same number of columns. |
Stdev | The standard deviation of a sample. |
stdev | The standard deviation of a whole population. |
str2num | The number written in the string s. |
strlen | The number of characters in s. |
submatrix | The part of A from row ir to jr and column ic to jc, counting from ORIGIN. |
substr | n characters of s from position m (counting from 0). |
sum | The sum of the elements of v, or of f over the range variable i, or over i from a to b. Also written with Σ. |
tan | The tangent of x. |
tanh | The hyperbolic tangent of x. |
time | The time now in seconds (z is not used), for timing a long calculation. |
tr | The trace of the square matrix M, the sum of its diagonal. |
trace | Returns x, for compatibility with imported sheets. |
Trunc | The multiple of y nearest x towards zero. |
trunc | The integer part of x, towards zero. |
UnitsOf | The same as SIUnitsOf. |
use | The functions of a Python file, as a module: bt := use "beam.py", then bt.f(x); in the desktop app. |
Var | The variance of the numbers as a sample (dividing by n − 1). |
var | The variance of the numbers as a whole population (dividing by n). |
vec | The expression evaluated element by element over its arrays (the vectorize arrow). |
vlookup | The 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. |