Skip to content

Built-in functions

One entry per function, in the order autosuggest lists them. Matrix and vector functions, the symbolic operations and the table functions have pages of their own: Matrix functions, Symbolic functions and Table functions. The guides cover units, angles and how results are shown.

abs(x)

The absolute value of a number or quantity. On a matrix it applies to every element. The bars |x| are a different reading, the length of a vector or the determinant of a square matrix. See Matrix functions.

Parameter Meaning
x A number, a quantity with units, or a matrix.

The magnitude, keeping the units; for a matrix, a matrix of magnitudes.

Message When
Too few arguments in function abs / Too many arguments in function abs Not exactly one argument
Unexpected type of argument in function abs The argument isn’t numeric
acos(x)

The inverse cosine. Returns an angle in radians as a plain number; set the block’s result unit to deg to show it in degrees.

Parameter Meaning
x A number without units. Outside the result is complex.

The angle in radians, as a number.

Message When
Too few arguments in function acos / Too many arguments in function acos Not exactly one argument
Unexpected type of argument in function acos The argument carries units or isn’t numeric
acosh(x)

The inverse hyperbolic cosine.

Parameter Meaning
x A number without units. Below the result is complex.

A number.

Message When
Too few arguments in function acosh / Too many arguments in function acosh Not exactly one argument
Unexpected type of argument in function acosh The argument carries units or isn’t numeric
asin(x)

The inverse sine. Returns an angle in radians as a plain number; set the block’s result unit to deg to show it in degrees.

Parameter Meaning
x A number without units. Outside the result is complex.

The angle in radians, as a number.

Message When
Too few arguments in function asin / Too many arguments in function asin Not exactly one argument
Unexpected type of argument in function asin The argument carries units or isn’t numeric

With the block’s result unit set to deg, the same value shows as .

asinh(x)

The inverse hyperbolic sine.

Parameter Meaning
x A number without units.

A number.

Message When
Too few arguments in function asinh / Too many arguments in function asinh Not exactly one argument
Unexpected type of argument in function asinh The argument carries units or isn’t numeric
atan(x)

The inverse tangent. Returns an angle in radians as a plain number; set the block’s result unit to deg to show it in degrees. For a full-circle angle from two coordinates, use atan2.

Parameter Meaning
x A number without units.

The angle in radians, between and .

Message When
Too few arguments in function atan / Too many arguments in function atan Not exactly one argument
Unexpected type of argument in function atan The argument carries units or isn’t numeric
atan2(y, x)

The angle of the point from the positive -axis, in the correct quadrant. Note the argument order: first.

Parameter Meaning
y A number without units.
x A number without units.

The angle in radians, between and , as a number; set the block’s result unit to deg to show it in degrees.

Message When
Too few arguments in function atan2 / Too many arguments in function atan2 Not exactly two arguments
Unexpected type of argument in function atan2 An argument carries units or isn’t numeric
atanh(x)

The inverse hyperbolic tangent.

Parameter Meaning
x A number without units. Outside the result is complex.

A number.

Message When
Too few arguments in function atanh / Too many arguments in function atanh Not exactly one argument
Unexpected type of argument in function atanh The argument carries units or isn’t numeric
ceil(x)
ceil(x, unit)

Rounds up, towards . A quantity with units must say which unit to round in.

Parameter Meaning
x A number, or a quantity with units.
unit Required when x has units: the unit to round in, as a bare unit such as cm.

The rounded value; for a quantity, in the unit named.

Message When
Too few arguments in function ceil A quantity with units but no unit to round in
Too many arguments in function ceil Too many arguments
Unexpected type of argument in function ceil The argument isn’t numeric
cos(x)

The cosine. A plain number is taken as radians; write the angle with a unit, 60.deg, to work in degrees.

Parameter Meaning
x An angle: a plain number in radians, or a quantity in deg or rad.

A number.

Message When
Unit in function cot is no angle The argument carries a unit that isn’t an angle (the message names cot whichever trig function was used)
Too few arguments in function cos / Too many arguments in function cos Not exactly one argument
cosh(x)

The hyperbolic cosine.

Parameter Meaning
x A number without units.

A number.

Message When
Too few arguments in function cosh / Too many arguments in function cosh Not exactly one argument
Unexpected type of argument in function cosh The argument carries units or isn’t numeric
cot(x)

The cotangent, . A plain number is taken as radians.

Parameter Meaning
x An angle: a plain number in radians, or a quantity in deg or rad.

A number.

Message When
Unit in function cot is no angle The argument carries a unit that isn’t an angle
Too few arguments in function cot / Too many arguments in function cot Not exactly one argument
csc(x)

The cosecant, . A plain number is taken as radians.

Parameter Meaning
x An angle: a plain number in radians, or a quantity in deg or rad.

A number.

Message When
Unit in function cot is no angle The argument carries a unit that isn’t an angle (the message names cot whichever trig function was used)
Too few arguments in function csc / Too many arguments in function csc Not exactly one argument
exp(x)

raised to the power . Writing e^x is the same thing.

Parameter Meaning
x A number without units.

A number.

Message When
Unexpected type of argument in function exp The argument carries units
Cannot convert “…” to a number The argument is text
Too few arguments in function exp / Too many arguments in function exp Not exactly one argument
floor(x)
floor(x, unit)

Rounds down, towards . A quantity with units must say which unit to round in.

Parameter Meaning
x A number, or a quantity with units.
unit Required when x has units: the unit to round in, as a bare unit such as m.

The rounded value; for a quantity, in the unit named.

Message When
Too few arguments in function floor A quantity with units but no unit to round in
Too many arguments in function floor Too many arguments
Unexpected type of argument in function floor The argument isn’t numeric
if(condition, then, else)

A conditional value. Only the branch that is taken is evaluated, so an error in the other branch does no harm: if(x > 0, 1/x, 0) is safe at . Comparisons of text compare the text; a comparison of two matrices is true when every element matches.

Parameter Meaning
condition Anything that is true or false: a comparison such as a > b, comparisons joined with and, or, not, or a number, where zero is false and anything else true.
then The value when the condition holds.
else The value otherwise.

Whichever of then or else applies, evaluated.

Message When
if expects 3 arguments: if(condition, then, else) Not exactly three arguments
integrate(expression, x)
integrate(expression, x, a, b)
∫ expression dx
∫_a^b expression dx
expression → integrate, x

With limits, the definite integral of an expression over x from a to b, worked out numerically by adaptive Gauss–Kronrod quadrature to a relative accuracy of about . x is the integral’s own variable: a value of x defined on the sheet is ignored inside the call and left unchanged outside it. The limits are evaluated where the call is written, so a function of its upper limit, , is a running integral. The limits themselves are never sampled, so an expression that is infinite at a limit but integrable there, such as at 0, still converges. The limits must be finite.

Without limits, the antiderivative as a formula, with no constant of integration. It is a symbolic operation: names defined above are substituted except x, and the formula evaluates to a number once every name in it is defined, so is a callable function and an exact definite integral. Every formula is checked by differentiating it numerically against the expression before it is shown.

The integral sign is the same call written as typeset maths, and nests for a double or triple integral; the arrow is the formula’s Mathcad spelling.

Parameter Meaning
expression What to integrate, written in terms of x. It may call functions and use values defined above. With limits, it must give a single real number at every point of the range, in the same units throughout.
x The variable of integration: a plain name such as x or t.
a The lower limit. A finite number, or a quantity. Leave out a and b for the formula.
b The upper limit, in the same units as a. Below a, the integral comes out negative.

With limits, the integral, as a number or as a quantity whose units are the expression’s units times the limits’ units: a load in kN/m integrated over metres gives kN.

Without limits, the antiderivative as an expression, or its value once every name in it is defined. Coefficients that come back as decimals are shown to six significant figures.

Message When
integrate expects 2 arguments for a formula, integrate(expression, variable), or 4 for a number, integrate(expression, variable, a, b) Neither two nor four arguments
integrate needs the variable to integrate over: write integrate(x^2, x), or end an integral with d and the variable, as in ∫ x² dx Without limits: the second argument isn’t a plain name, or an integral sign has no dx
integrate needs the variable to integrate over: write integrate(x^2, x, 0, 2), or end an integral with d and the variable, as in ∫ x² dx With limits: the same
integrate found no formula for this integral in x — for its value over a range, give the limits: integrate(f, x, a, b) Without limits, when no formula exists in ordinary functions, such as for
integrate’s formula for this needs the sine integral Si, which Maths Explore can’t evaluate — for its value over a range, give the limits: integrate(f, x, a, b) Without limits, when the formula needs a special function; the message names it (the sine or cosine integral, erfi, a Fresnel integral, li, Ei and others)
integrate gave up looking for a formula for this integral in x after 1 s — for its value over a range, give the limits: integrate(f, x, a, b) Without limits, when the search takes more than a second
integrate couldn’t find a formula for this integral in x that checks out — for its value over a range, give the limits: integrate(f, x, a, b) Without limits, when the formula found fails the numerical check
integrate can’t work out a formula through if(…) — for its value over a range, give the limits: integrate(f, x, a, b) Without limits, when the expression applies a function with no formula form, such as if, to x
integrate expects a and b to share the same units One limit has units and the other doesn’t, or they differ in kind
integrate expects a to be a finite real number / integrate expects b to be a finite real number A limit isn’t numeric, or is infinite
integrate expects the expression to give a real number, but at x = … it is complex The expression goes complex inside the range, such as below zero
integrate expects the expression to give a single value, not a matrix or vector The expression is a matrix or vector
integrate expects the expression to give a single real number at x = … The expression is text, or true or false
integrate expects the expression’s units to stay the same across the range; they change at x = … The expression changes dimension partway, such as an if with differently dimensioned branches
integrate: the expression is not a finite number at x = … The expression is infinite or undefined inside the range
integrate did not converge within 20000 evaluations: the integral may not exist over this range, or the expression changes too sharply The integral diverges, such as from 0 to 1, or can’t be pinned down to the accuracy
integrate stopped: these nested integrals need too many evaluations (more than 100000 between them) A double or triple integral would cost too much
ln(x)

The natural logarithm, base . The \ln command and the typed letters are the same function. For base 10 use log.

Parameter Meaning
x A number without units. Zero gives ; a negative number gives a complex result.

A number.

Message When
Too few arguments in function log The argument carries units (the message names log, which ln is built on)
Too few arguments in function ln / Too many arguments in function ln Not exactly one argument
log(x)
log(x, base)

The logarithm. With one argument it is base 10, as on paper and in Mathcad, not the natural log. With two arguments it is the log of x to base. The \log command is the same function; for the natural log use ln.

Parameter Meaning
x A number without units. Zero gives ; a negative number gives a complex result.
base Optional. The base; 10 when omitted.

A number.

Message When
Too few arguments in function log The argument carries units
Too many arguments in function log More than two arguments
log10(x)

The base-10 logarithm, written out. Identical to one-argument log.

Parameter Meaning
x A number without units. Zero gives ; a negative number gives a complex result.

A number.

Message When
Unexpected type of argument in function log10 The argument carries units or isn’t numeric
Too few arguments in function log10 / Too many arguments in function log10 Not exactly one argument
max(a, b, c, …)
max(A)
max(A, dimension)

The largest of several values, or of all the values in a matrix. Quantities are compared after converting units, and the winner keeps the unit it was written in. On a matrix, dimension gives the maximum of each column (1) or of each row (2) instead.

Parameter Meaning
a, b, c, … Two or more values to compare. All numbers, or all quantities of one kind.
A A list or matrix of values.
dimension Optional. 1 for the maximum down each column, 2 along each row.

The largest value, or a vector of them when dimension is given.

Message When
Cannot calculate max, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric
Cannot calculate max of an empty array An empty list
mean(a, b, c, …)
mean(A)
mean(A, dimension)

The arithmetic mean. Quantities are converted to one unit first. On a matrix, dimension gives the mean of each column (1) or of each row (2) instead.

Parameter Meaning
a, b, c, … The values. All numbers, or all quantities of one kind.
A A list or matrix of values.
dimension Optional. 1 for the mean down each column, 2 along each row.

The mean, in the unit of the first value.

Message When
Cannot calculate the mean of an empty array An empty list
Cannot calculate mean, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric
median(a, b, c, …)
median(A)

The middle value once the values are sorted; the average of the two middle values when there is an even number of them.

Parameter Meaning
a, b, c, … The values. All numbers, or all quantities of one kind.
A A list or matrix of values. Every element counts.

The median.

Message When
Cannot calculate median of an empty array An empty list
Cannot calculate median, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric
min(a, b, c, …)
min(A)
min(A, dimension)

The smallest of several values, or of all the values in a matrix. Quantities are compared after converting units, and the winner keeps the unit it was written in. On a matrix, dimension gives the minimum of each column (1) or of each row (2) instead.

Parameter Meaning
a, b, c, … Two or more values to compare. All numbers, or all quantities of one kind.
A A list or matrix of values.
dimension Optional. 1 for the minimum down each column, 2 along each row.

The smallest value, or a vector of them when dimension is given.

Message When
Cannot calculate min, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric
Cannot calculate min of an empty array An empty list
mod(x, y)

The remainder of . The result takes the sign of y, so mod(-7, 3) is , not . A divisor of zero returns x unchanged.

Parameter Meaning
x A number without units.
y A number without units.

A number with the sign of y.

Message When
Unexpected type of argument in function mod An argument carries units or isn’t numeric
Too few arguments in function mod / Too many arguments in function mod Not exactly two arguments
mode(a, b, c, …)
mode(A)

The most frequent value. The result is always a vector, because there may be several, and when every value occurs equally often all of them are returned.

Parameter Meaning
a, b, c, … The values.
A A list or matrix of values.

A vector of the most frequent values.

Message When
Too few arguments in function mode No arguments
prod(a, b, c, …)
prod(A)

The product of all the values. Units multiply through.

Parameter Meaning
a, b, c, … The values.
A A list or matrix of values. Every element counts.

The product, with the product of the units.

Message When
Cannot calculate prod of an empty array An empty list
Too few arguments in function prod No arguments
random()
random(max)
random(min, max)
random(size)
random(size, max)
random(size, min, max)

A random number, uniformly distributed. The sheet re-evaluates whenever anything changes, so the value changes too. It is not fixed once drawn.

Parameter Meaning
max Optional. Upper limit, excluded; 1 when omitted.
min Optional. Lower limit, included; 0 when omitted.
size Optional. A list such as [2, 3] giving the rows and columns of a matrix to fill.

A number min and max, or a matrix of them.

Message When
Too many arguments in function random Three arguments where the first isn’t a size
root(f, a, b)

A numerical root of between a and b, found by Brent’s method. The bracket must straddle the root, with and of opposite sign, and the root is returned in the bracket’s units. This is the fallback solve points you at when an equation has no closed form.

Parameter Meaning
f A function of one variable, defined above as f(x) := … and passed by name. Its value only matters by sign, so it may carry units.
a One end of the bracket. A number, or a quantity.
b The other end, in the same units as a.

The root, as a number or in the bracket’s units. If an end of the bracket is itself a root, that end is returned.

Message When
root(f, a, b) needs a sign change: f(a) and f(b) have the same sign, so no root is bracketed The bracket doesn’t straddle a root
root expects its first argument to be a function, as in root(f, a, b) f isn’t a function
root expects a and b to share the same units One end has units and the other doesn’t, or they differ in kind
root expects a to be a real number / root expects b to be a real number An end isn’t numeric
root expects f(x) to return a finite real value across the bracket f gives infinity or an error somewhere in the bracket
root(f, a, b) did not converge within 128 iterations No root found within the iteration cap
round(x)
round(x, n)
round(x, unit)
round(x, n, unit)

Rounds to the nearest whole number, or to n decimal places. Halves round away from zero. A quantity with units must say which unit to round in.

Parameter Meaning
x A number, or a quantity with units.
n Optional. Decimal places, a whole number from 0 to 15.
unit Required when x has units: the unit to round in, as a bare unit such as cm.

The rounded value; for a quantity, in the unit named.

Message When
Number of decimals in function round must be an integer from 0 to 15 inclusive n is negative, fractional or too large
Too few arguments in function round A quantity with units but no unit to round in
Too many arguments in function round Too many arguments
sec(x)

The secant, . A plain number is taken as radians.

Parameter Meaning
x An angle: a plain number in radians, or a quantity in deg or rad.

A number.

Message When
Unit in function cot is no angle The argument carries a unit that isn’t an angle (the message names cot whichever trig function was used)
Too few arguments in function sec / Too many arguments in function sec Not exactly one argument
sin(x)

The sine. A plain number is taken as radians; write the angle with a unit, 30.deg, to work in degrees.

Parameter Meaning
x An angle: a plain number in radians, or a quantity in deg or rad.

A number.

Message When
Unit in function cot is no angle The argument carries a unit that isn’t an angle (the message names cot whichever trig function was used)
Too few arguments in function sin / Too many arguments in function sin Not exactly one argument
sinh(x)

The hyperbolic sine.

Parameter Meaning
x A number without units.

A number.

Message When
Too few arguments in function sinh / Too many arguments in function sinh Not exactly one argument
Unexpected type of argument in function sinh The argument carries units or isn’t numeric
sqrt(x)

The square root. The toolbar’s radical and the \sqrt command are the same function. Units come through: .

Parameter Meaning
x A number or a quantity. A negative number gives a complex result, not an error.

The principal square root, with the square root of the units.

Message When
Too few arguments in function sqrt / Too many arguments in function sqrt Not exactly one argument
Unexpected type of argument in function sqrt The argument isn’t numeric
std(a, b, c, …)
std(A)
std(A, normalization)

The standard deviation. By default this is the sample standard deviation, dividing by . Quantities keep their unit.

Parameter Meaning
a, b, c, … The values.
A A list or matrix of values. Every element counts.
normalization Optional, as text: "unbiased" (default, divide by ), "uncorrected" (divide by ) or "biased" (divide by ).

The standard deviation, in the values’ unit.

Message When
Cannot calculate variance of an empty array An empty list
Cannot calculate std, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric
sum(a, b, c, …)
sum(A)
sum(A, dimension)

The total of all the values. Quantities are converted to one unit first. On a matrix, dimension gives the total of each column (1) or of each row (2) instead. An empty list sums to zero.

Parameter Meaning
a, b, c, … The values. All numbers, or all quantities of one kind.
A A list or matrix of values.
dimension Optional. 1 for the total down each column, 2 along each row.

The total, in the unit of the first value.

Message When
Cannot calculate sum, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric
tan(x)

The tangent. A plain number is taken as radians; write the angle with a unit, 45.deg, to work in degrees.

Parameter Meaning
x An angle: a plain number in radians, or a quantity in deg or rad.

A number. At the result is a very large number rather than an error.

Message When
Unit in function cot is no angle The argument carries a unit that isn’t an angle (the message names cot whichever trig function was used)
Too few arguments in function tan / Too many arguments in function tan Not exactly one argument
tanh(x)

The hyperbolic tangent.

Parameter Meaning
x A number without units.

A number between and .

Message When
Too few arguments in function tanh / Too many arguments in function tanh Not exactly one argument
Unexpected type of argument in function tanh The argument carries units or isn’t numeric
variance(a, b, c, …)
variance(A)
variance(A, normalization)

The variance. By default this is the sample variance, dividing by . For quantities the unit is squared.

Parameter Meaning
a, b, c, … The values.
A A list or matrix of values. Every element counts.
normalization Optional, as text: "unbiased" (default, divide by ), "uncorrected" (divide by ) or "biased" (divide by ).

The variance, in the values’ unit squared.

Message When
Cannot calculate variance of an empty array An empty list
Cannot calculate variance, unexpected type of argument A plain number is mixed with a quantity, or the values aren’t numeric