Functions
Every function here is Desmos’ own, written as a call: sin(x), mean(L). A function of one list may also be written after it, as a member - L.mean is mean(L).
A name that is none of these, called like one, is an error (unknown-function) rather than the product of variables Desmos would take it for.
Trigonometry
Section titled “Trigonometry”sin(x) - Sine function
In radians, unless config { degreeMode: true } says degrees.
y = sin(x)cos(x) - Cosine function
In radians, unless config { degreeMode: true } says degrees.
y = cos(x)tan(x) - Tangent function
In radians, unless config { degreeMode: true } says degrees.
y = tan(x)csc(x) - Cosecant function
The reciprocal of sin. In radians, unless config { degreeMode: true } says degrees.
y = csc(x)sec(x) - Secant function
The reciprocal of cos. In radians, unless config { degreeMode: true } says degrees.
y = sec(x)cot(x) - Cotangent function
The reciprocal of tan. In radians, unless config { degreeMode: true } says degrees.
y = cot(x)arcsin
Section titled “arcsin”arcsin(x) - Arcsine function
Answers in radians, unless config { degreeMode: true } says degrees.
y = arcsin(x)arccos
Section titled “arccos”arccos(x) - Arccosine function
Answers in radians, unless config { degreeMode: true } says degrees.
y = arccos(x)arctan
Section titled “arctan”arctan(x) - Arctangent function
Answers in radians, unless config { degreeMode: true } says degrees.
y = arctan(x)arccsc
Section titled “arccsc”arccsc(x) - Arccosecant function
Answers in radians, unless config { degreeMode: true } says degrees.
y = arccsc(x)arcsec
Section titled “arcsec”arcsec(x) - Arcsecant function
Answers in radians, unless config { degreeMode: true } says degrees.
y = arcsec(x)arccot
Section titled “arccot”arccot(x) - Arccotangent function
Answers in radians, unless config { degreeMode: true } says degrees.
y = arccot(x)sinh(x) - Hyperbolic sine
y = sinh(x)cosh(x) - Hyperbolic cosine
y = cosh(x)tanh(x) - Hyperbolic tangent
y = tanh(x)csch(x) - Hyperbolic cosecant
y = csch(x)sech(x) - Hyperbolic secant
y = sech(x)coth(x) - Hyperbolic cotangent
y = coth(x)arcsinh
Section titled “arcsinh”arcsinh(x) - Inverse hyperbolic sine
y = arcsinh(x)arccosh
Section titled “arccosh”arccosh(x) - Inverse hyperbolic cosine
Defined from 1 up.
y = arccosh(x)arctanh
Section titled “arctanh”arctanh(x) - Inverse hyperbolic tangent
Defined between -1 and 1.
y = arctanh(x)arccsch
Section titled “arccsch”arccsch(x) - Inverse hyperbolic cosecant
y = arccsch(x)arcsech
Section titled “arcsech”arcsech(x) - Inverse hyperbolic secant
Defined above 0, up to 1.
y = arcsech(x)arccoth
Section titled “arccoth”arccoth(x) - Inverse hyperbolic cotangent
Defined outside -1 to 1.
y = arccoth(x)Arithmetic
Section titled “Arithmetic”sqrt(x) - Square root
y = sqrt(x)nthroot
Section titled “nthroot”nthroot(x, n) - Nth root
The nth root of x: nthroot(8, 3) is 2.
y = nthroot(x, 3)abs(x) - Absolute value
Also written with bars: |x|.
y = abs(x)ln(x) - Natural logarithm
y = ln(x)log(x) - Logarithm base 10, or to any base with a second argument
log(x, b) is the logarithm of x to the base b: log(8, 2) is 3.
y = log(x)z = log(8, 2)sum(n = 1..10, n) - Sum of a body over a range: sum(n = 1..10, n^2)
The variable is named once, with the range it runs over - both ends included, and either end any expression - and is bound in the body alone.
a = sum(n = 1..10, n^2)y = sum(k = 0..5, x^k / k!)prod(n = 1..10, n) - Product of a body over a range: prod(n = 1..5, n)
The variable is named once, with the range it runs over - both ends included, and either end any expression - and is bound in the body alone.
a = prod(n = 1..5, n)y = prod(k = 1..3, x - k)int(t = 0..1, t) - Definite integral of a body: int(t = 0..1, t^2)
The variable of integration is named once, with the bounds - either of them any expression - and is bound in the body alone.
a = int(t = 0..1, t^2)y = int(t = 0..x, cos(t))exp(x) - Exponential (e^x)
The same as e ^ x.
y = exp(x)floor(x) - Floor function
y = floor(x)ceil(x) - Ceiling function
y = ceil(x)round(x) - Round function
y = round(x)sign(x) - Sign function
-1 for a negative number, 1 for a positive one, and 0 for 0. sgn is the same function.
y = sign(x)sgn(x) - Sign function
Another name for sign.
y = sgn(x)mod(x, y) - Modulo
The remainder of x divided by y.
y = mod(x, 3)gcd(x, y) - Greatest common divisor
a = gcd(12, 18)lcm(x, y) - Least common multiple
a = lcm(4, 6)cross(u, v) - The cross product of two 3D points; for two numbers, their product
Desmos’ \times. u * v is the dot product of two 3D points, and cross(u, v) the vector at right angles to both.
u = (1, 2, 3)v = (4, 5, 6)n = cross(u, v)d = u * verf(x) - Error function
The integral of 2 / sqrt(pi) exp(-t^2) from 0 to x, which has no closed form.
y = erf(x)Statistics
Section titled “Statistics”total(list) - Sum of list
L = [3, 1, 4, 1, 5]s = total(L)length
Section titled “length”length(list) - Length of list
L = [3, 1, 4, 1, 5]n = length(L)count(list) - Number of elements in a list; also written list.count
Like every function of one list, it may be written after the list as a member: L.count.
L = [3, 1, 4, 1, 5]n = count(L)m = L.countmean(list) - Mean of list
L = [3, 1, 4, 1, 5]m = mean(L)median
Section titled “median”median(list) - Median of list
L = [3, 1, 4, 1, 5]m = median(L)min(list) - Minimum of list
L = [3, 1, 4, 1, 5]m = min(L)max(list) - Maximum of list
L = [3, 1, 4, 1, 5]m = max(L)stdev(list) - Standard deviation
The sample standard deviation. stdevp is the population one.
L = [3, 1, 4, 1, 5]s = stdev(L)stdevp
Section titled “stdevp”stdevp(list) - Population standard deviation
L = [3, 1, 4, 1, 5]s = stdevp(L)mad(list) - Mean absolute deviation
L = [3, 1, 4, 1, 5]d = mad(L)var(list) - Variance
The sample variance. varp is the population one.
L = [3, 1, 4, 1, 5]v = var(L)varp(list) - Population variance
L = [3, 1, 4, 1, 5]v = varp(L)quantile
Section titled “quantile”quantile(list, p) - The value a fraction p of the way through a list
quantile(L, 0.5) is the median. p runs from 0 to 1, and the answer is interpolated between the two values it falls between.
L = [3, 1, 4, 1, 5]q = quantile(L, 0.9)quartile
Section titled “quartile”quartile(list, n) - The first, second or third quartile of a list
quartile(L, 2) is the median; 0 and 4 are the minimum and maximum.
L = [3, 1, 4, 1, 5]q = quartile(L, 1)cov(xs, ys) - Covariance of two lists
The sample covariance. covp is the population one.
xs = [1, 2, 3, 4]ys = [2, 4, 5, 9]c = cov(xs, ys)covp(xs, ys) - Population covariance of two lists
xs = [1, 2, 3, 4]ys = [2, 4, 5, 9]c = covp(xs, ys)corr(xs, ys) - Correlation coefficient of two lists
Pearson’s r, from -1 to 1.
xs = [1, 2, 3, 4]ys = [2, 4, 5, 9]r = corr(xs, ys)spearman
Section titled “spearman”spearman(xs, ys) - Rank correlation of two lists
Spearman’s rho: the correlation of the two lists’ ranks, so any rising relationship scores 1.
xs = [1, 2, 3, 4]ys = [2, 4, 5, 9]r = spearman(xs, ys)tscore
Section titled “tscore”tscore(list, mu) - The t-score of a list’s mean against a value
(mean(L) - mu) / (stdev(L) / sqrt(length(L))).
L = [3, 1, 4, 1, 5]t = tscore(L, 2)discretedist
Section titled “discretedist”discretedist(values, weights) - Discrete distribution over values with optional weights (new in Desmos v1.12)
Without weights, every value is equally likely.
D = discretedist([1, 2, 3], [0.2, 0.3, 0.5])random
Section titled “random”random() - Random number in [0, 1); random(n) gives a list of n, random(list) shuffles it
The numbers stay put until the graph is reseeded; config { randomSeed: "…" } fixes the seed.
a = random()L = random(5)Distributions
Section titled “Distributions”normaldist
Section titled “normaldist”normaldist(mean, stdev) - Normal distribution with a mean and a standard deviation
With no arguments, the standard normal: mean 0, standard deviation 1. Evaluate one with .pdf(x), .cdf(x) or .random(n).
D = normaldist(0, 1)y = D.pdf(x)tdist(dof) - Student’s t-distribution with some degrees of freedom
T = tdist(4)y = T.pdf(x)chisqdist
Section titled “chisqdist”chisqdist(dof) - Chi-squared distribution with some degrees of freedom
C = chisqdist(3)y = C.pdf(x)uniformdist
Section titled “uniformdist”uniformdist(min, max) - Uniform distribution between two values
With no arguments, between 0 and 1.
U = uniformdist(0, 4)p = U.cdf(1)binomialdist
Section titled “binomialdist”binomialdist(trials, p) - Binomial distribution: successes in some trials, each with a probability
B = binomialdist(10, 0.5)p = B.pdf(5)poissondist
Section titled “poissondist”poissondist(mean) - Poisson distribution with a mean
P = poissondist(3)p = P.pdf(2)geodist
Section titled “geodist”geodist(p) - Geometric distribution: trials until the first success
G = geodist(0.3)p = G.cdf(4)pdf(dist, x) - A distribution’s probability density (or mass) at a value; usually written D.pdf(x)
D = normaldist(0, 1)y = D.pdf(x)cdf(dist, x) - The probability a distribution’s value is at most x, or between two values; usually written D.cdf(x)
D.cdf(x) is the probability of a value up to x, and D.cdf(a, b) of one between a and b.
D = normaldist(0, 1)p = D.cdf(1)q = D.cdf(-1, 1)Hypothesis tests
Section titled “Hypothesis tests”ttest(list) - t-test of one list against a mean, or of two lists against each other
With one list, it tests its mean against 0 - .null(mu) changes that. With two, it tests the difference of their means. Read the result with its members: .score, .pleft, .pright, .dof, .estimate, .stderr, .conf(level).
before = [12, 15, 11, 14]after = [14, 17, 13, 15]p = ttest(before, after).pleftztest(list, sigma) - z-test of a list’s mean, given the population standard deviation
L = [12, 15, 11, 14]z = ztest(L, 2).scorezproptest
Section titled “zproptest”zproptest(successes, count) - z-test of a proportion: successes out of a count, or two of them compared
p = zproptest(40, 100).pleftq = zproptest(40, 100, 70, 100).scorechisqtest
Section titled “chisqtest”chisqtest(column, column) - Chi-squared test for independence of the columns of a two-way table
c = chisqtest([10, 20], [30, 25]).scorechisqgof
Section titled “chisqgof”chisqgof(observed, expected) - Chi-squared goodness-of-fit test of observed counts against expected ones
g = chisqgof([10, 20, 30], [20, 20, 20]).scorescore(test) - A test’s statistic: its t, z or chi-squared score; usually written T.score
L = [12, 15, 11, 14]T = ttest(L)s = T.scorepleft(test) - A test’s p-value for the alternative that the true value is less; usually written T.pleft
L = [12, 15, 11, 14]T = ttest(L)p = T.pleftpright
Section titled “pright”pright(test) - A test’s p-value for the alternative that the true value is greater; usually written T.pright
L = [12, 15, 11, 14]T = ttest(L)p = T.prightdof(test) - A test’s degrees of freedom; usually written T.dof
L = [12, 15, 11, 14]T = ttest(L)d = T.dofestimate
Section titled “estimate”estimate(test) - The value a test estimates, such as a sample mean; usually written T.estimate
L = [12, 15, 11, 14]T = ttest(L)m = T.estimatestderr
Section titled “stderr”stderr(test) - A test’s standard error; usually written T.stderr
L = [12, 15, 11, 14]T = ttest(L)se = T.stderrconf(test, level) - A confidence interval at a level; usually written T.conf(0.95)
Its ends are read with .lower and .upper.
L = [12, 15, 11, 14]T = ttest(L)C = T.conf(0.95)lo = C.lowerhi = C.uppernull(test, value) - The same test against another null value; usually written T.null(mu)
L = [12, 15, 11, 14]T = ttest(L)p = T.null(12).prightlower(interval) - The lower end of a confidence interval; usually written C.lower
L = [12, 15, 11, 14]T = ttest(L)lo = T.conf(0.95).lowerupper(interval) - The upper end of a confidence interval; usually written C.upper
L = [12, 15, 11, 14]T = ttest(L)hi = T.conf(0.95).upperCharts
Section titled “Charts”histogram
Section titled “histogram”histogram(list, width) - Histogram of a list, with an optional bin width
A statement of its own: it draws the chart, and cannot be assigned or used in an expression. binAlignment and histogramMode set it up.
L = [3, 5, 5, 6, 8, 9, 9, 9, 12]histogram(L, 2) @ binAlignment: leftdotplot
Section titled “dotplot”dotplot(list) - Dot plot of a list, with an optional bin width
A statement of its own: it draws the chart, and cannot be assigned or used in an expression. dotplotXMode says whether a dot stands at its value or its bin.
L = [3, 5, 5, 6, 8, 9, 9, 9, 12]dotplot(L) @ dotplotXMode: binboxplot
Section titled “boxplot”boxplot(list) - Box-and-whisker plot of a list
A statement of its own: it draws the chart, and cannot be assigned or used in an expression. axisOffset and breadth place and size it; showBoxplotOutliers: false draws the whiskers to the extremes.
L = [3, 5, 5, 6, 8, 9, 9, 9, 12]boxplot(L) @ axisOffset: 2, breadth: 1stats(list) - A row of summary statistics for a list: min, quartiles, max
A statement of its own, shown in the expression list; it cannot be assigned or used in an expression.
L = [3, 5, 5, 6, 8, 9, 9, 9, 12]stats(L)repeat
Section titled “repeat”repeat(value, n) - Repeat a value or list n times (new in Desmos v1.12)
L = repeat(2, 3)join(a, b) - Concatenate lists or values into one list
L = join([1, 2], [3, 4])sort(list) - Sort a list, optionally by a second list
Given a second list, sorts the first by it.
L = sort([3, 1, 2])M = sort([10, 20, 30], [3, 1, 2])unique
Section titled “unique”unique(list) - The distinct values of a list, in the order they first appear
L = unique([1, 2, 2, 3, 1])shuffle
Section titled “shuffle”shuffle(list) - A list in random order
L = shuffle([1, 2, 3, 4, 5])Geometry
Section titled “Geometry”polygon
Section titled “polygon”polygon(points) - Polygon from points or a point list
Takes the vertices as separate points, or one list of points.
polygon((0, 0), (4, 0), (2, 3))polygonGlider
Section titled “polygonGlider”polygonGlider(polygon, t) - The point a fraction of the way around a polygon’s perimeter
T = polygon((0, 0), (4, 0), (2, 3))polygonGlider(T, 0.5)polygonInteriorDirectedAngles
Section titled “polygonInteriorDirectedAngles”polygonInteriorDirectedAngles(polygon, n) - The signed interior angles of a polygon
T = polygon((0, 0), (4, 0), (2, 3))A = polygonInteriorDirectedAngles(T, 1)distance
Section titled “distance”distance(A, B) - Distance between two points
d = distance((0, 0), (3, 4))midpoint
Section titled “midpoint”midpoint(A, B) - Midpoint of two points
midpoint((0, 0), (4, 2))segment
Section titled “segment”segment(A, B) - The segment between two points
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)s = segment(A, B)line(A, B) - The line through two points
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)line(A, B)ray(A, B) - The ray from one point through another
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)ray(A, B)vector
Section titled “vector”vector(A, B) - The vector from one point to another
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)v = vector(A, B)circle
Section titled “circle”circle(center, radius) - A circle about a centre, through a point or with a radius
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)circle(A, B)circle(B, 2)arc(A, B, C) - The arc through three points, from the first to the last
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)arc(A, C, B)glider
Section titled “glider”glider(path, t) - A point a fraction of the way along a path, which the viewer can slide
The path is a segment, a line, a circle, an arc or a polygon; t from 0 to 1 goes once along it.
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)s = segment(A, B)P = glider(s, 0.25)parallel
Section titled “parallel”parallel(line, point) - The line through a point parallel to a line
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)parallel(line(A, B), C)perpendicular
Section titled “perpendicular”perpendicular(line, point) - The line through a point perpendicular to a line
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)perpendicular(line(A, B), C)intersection
Section titled “intersection”intersection(a, b) - Where two lines, circles or arcs cross
Where two objects cross more than once, it is a list of the points.
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)P = intersection(circle(A, B), line(B, C))strictintersection
Section titled “strictintersection”strictintersection(a, b) - Where two objects cross, only within their extents
A segment, a ray or an arc stops where it ends here, where intersection treats it as the whole line or circle.
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)P = strictintersection(segment(A, B), segment(C, (2, -2)))angle(A, vertex, C) - The angle at the middle of three points
Always the smaller way round; directedangle keeps the direction.
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)a = angle(A, B, C)directedangle
Section titled “directedangle”directedangle(A, vertex, C) - The angle turned from the first point to the last about the middle one
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)a = directedangle(A, B, C)angles
Section titled “angles”angles(polygon) - The interior angles of a polygon
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)T = polygon(A, B, C)angles(T)directedangles
Section titled “directedangles”directedangles(polygon) - The signed interior angles of a polygon
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)T = polygon(A, B, C)directedangles(T)anglebisector
Section titled “anglebisector”anglebisector(angle) - The ray that bisects an angle
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)anglebisector(angle(A, B, C))coterminal
Section titled “coterminal”coterminal(angle) - The other way round an angle
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)coterminal(angle(A, B, C))supplement
Section titled “supplement”supplement(angle) - The supplement of a directed angle
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)supplement(directedangle(A, B, C))center
Section titled “center”center(circle) - The centre of a circle or an arc
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)c = circle(A, B)O = center(c)radius
Section titled “radius”radius(circle) - The radius of a circle or an arc
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)c = circle(A, B)r = radius(c)area(polygon) - The area of a polygon
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)a = area(polygon(A, B, C))perimeter
Section titled “perimeter”perimeter(polygon) - The perimeter of a polygon
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)p = perimeter(polygon(A, B, C))start(vector) - The point a vector starts at
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)v = vector(A, B)start(v)end(vector) - The point a vector ends at
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)v = vector(A, B)end(v)vertices
Section titled “vertices”vertices(polygon) - The corners of a polygon, as a list of points
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)vertices(polygon(A, B, C))segments
Section titled “segments”segments(polygon) - The sides of a polygon, as a list of segments
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)segments(polygon(A, B, C))translate
Section titled “translate”translate(object, from, to) - An object moved by a vector, or from one point to another
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)T = polygon(A, B, C)translate(T, A, (2, 2))rotate
Section titled “rotate”rotate(object, center, angle) - An object turned about a point by an angle
The angle is a number, or an angle made with angle.
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)T = polygon(A, B, C)rotate(T, A, pi / 2)dilate
Section titled “dilate”dilate(object, center, factor) - An object scaled about a point by a factor
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)T = polygon(A, B, C)dilate(T, A, 2)reflect
Section titled “reflect”reflect(object, line) - An object reflected in a line
config { calculator: GEOMETRY }A = (0, 0)B = (4, 1)C = (1, 3)T = polygon(A, B, C)reflect(T, line(A, B))triangle
Section titled “triangle”triangle(A, B, C) - The triangle with three 3D points as corners
config { calculator: GRAPHING_3D }triangle((0, 0, 0), (1, 0, 0), (0, 1, 1))sphere
Section titled “sphere”sphere(center, radius) - The sphere about a 3D point with a radius
config { calculator: GRAPHING_3D }sphere((0, 0, 0), 2)Colour
Section titled “Colour”rgb(r, g, b) - Color from red, green, blue (0-255)
Each channel runs from 0 to 255. A colour is a value like any other, so it may be stored in a variable and given to color:.
y = sin(x) @ color: rgb(255, 128, 0)hsv(h, s, v) - Color from hue, saturation, value
Hue in degrees, 0 to 360; saturation and value from 0 to 1.
y = sin(x) @ color: hsv(200, 0.8, 0.9)okhsv(h, s, v) - Perceptually uniform color from hue, saturation, value (new in Desmos v1.12)
y = sin(x) @ color: okhsv(200, 0.8, 0.9)oklab(l, a, b) - Perceptually uniform color from lightness, a, b (new in Desmos v1.12)
y = sin(x) @ color: oklab(0.6, 0.1, -0.1)oklch(l, c, h) - Perceptually uniform color from lightness, chroma, hue (new in Desmos v1.12)
y = sin(x) @ color: oklch(0.6, 0.15, 30)Combinatorics
Section titled “Combinatorics”nCr(n, r) - Combinations
How many ways to choose r of n things, order not counting.
a = nCr(5, 2)nPr(n, r) - Permutations
How many ways to arrange r of n things, order counting.
a = nPr(5, 2)factorial
Section titled “factorial”factorial(n) - Factorial
Also written postfix: 5!.
a = factorial(5)b = 5!Complex numbers
Section titled “Complex numbers”real(z) - Real part of a complex number
Only in complex mode, which config { allowComplex: true } turns on.
config { allowComplex: true }z = 3 + 4ia = real(z)imag(z) - Imaginary part of a complex number
Only in complex mode, which config { allowComplex: true } turns on.
config { allowComplex: true }z = 3 + 4ib = imag(z)conj(z) - Complex conjugate
Only in complex mode, which config { allowComplex: true } turns on.
config { allowComplex: true }z = 3 + 4iw = conj(z)arg(z) - Argument (angle) of a complex number
The angle from the positive real axis, from -π to π. Only in complex mode, which config { allowComplex: true } turns on.
config { allowComplex: true }z = 3 + 4im = arg(z)tone(frequency, volume) - Play a tone at a frequency in hertz, at a volume of 0-1
Desmos shows a button to play it.
tone(440, 0.5)