Introduction
Welcome to the Unofficial Desmos Cheatsheet!
Equations
Under every equation, there will be a copyable version of it.
| Example |
|---|
| \[f(x)=\sum_{n=1}^{x}\frac{1}{n}\] |
f\left(x\right)=\sum_{n=1}^{x}\frac{1}{n} |
Useful functions for creating art
When recreating an image, there are a few simple functions which can make it easier. These will be listed on this page.
Linear functions
For a project like this, these are most easily written in point slope form, as follows
| Equation | Copyable |
|---|---|
| \(y=y_1-m(x_1-x)\) | y=y_1-m\left(x_1-x\right) |
Quadratic functions
These are easily written in either vertex form or factored form.
| Form | Equation | Copyable |
|---|---|---|
| Vertex | \(y=a(x-h)^2+k\) | y=m\left(x-h\right)^2+k |
| Factored | \(y=a(x-r_1)(x-r_2)\) | y=a\left(x-r_1\right)\left(x-r_2\right) |
| Standard | \(y=ax^2+bx+c\) | y=ax^2+bx+c |
Exponential functions
Given \[a\text{ is a real number}\\b\gt1\\c\ne0\\(h,k)\text{ are real numbers}\] You can use the general exponential formula provided below.
| Equation | Copyable |
|---|---|
| \(ab^{c(x-h)}+k\) | ab^{c\left(x-h\right)}+k |
The point \((h,k)\) defines the vertical and horizontal shift. If one equals zero, then it can be omitted.
\(a\) and \(c\) are the vertical and horizontal stretch, respectively. If one equals one, then it can be omitted. \(a\)'s sign (\(+\) or \(-\)) defines whether it curves up or down.
\(b\) is the base of the exponential equation, and defines how "tightly" it curves upwards. It can never be omitted.
Rational Functions
Rational functions are written as the ratio between two polynomial functions. Note that constants such as \(2\) or \(\pi\) are still polynomial.
| Equation | Copyable |
|---|---|
| \(\frac{P_1(x)}{P_2(x)}\) | \\frac{P\left(x\right)}{Q\left(x\right)} |
where \(P_1(x)\) and \(P_2(x)\) are both polynomial functions
Special case: \(\frac{1}{x}\)
Likely the most useful rational equation when making art is \(\frac{\text{constant}}{\text{linear}}\).
It's full form is \(\frac{a}{x-b}+c\)—or \frac{a}{x-b}+c—given the following:
\[a\ne0\\b\text{ and }c\text{ are real numbers}\]
\(a\) defines how closely it curve towards the asymptotes as well as which direction it curves.
It can never be omitted.
\(b\) and \(c\) equal the vertical and horizontal asymptotes, respectively.
If either is zero, it can be left out.
Implicit Circle Function
It can be written in two main ways: the magnitude of a point, and the distance function.
Given radius \(r\), midpoint \((a,b)\), and shift \((x_1,y_1)\)
| Equation | Copyable |
|---|---|
| \(\frac{(x-a)}{x_1}^2+\frac{(y-b)}{y_1}^2=r^2\) | \frac{\left(x-a\right)}{x_{1}}^{2}+\frac{\left(y-b\right)}{y_{1}}^{2}=r^{2} |
| \(\left|\left(\frac{x-a}{x_1},\frac{y-b}{y_1}\right)\right|=r\) | \left|\left(\frac{x-a}{x_{1}},\frac{y-b}{y_{1}}\right)\right|=r |
Table of supported functions
| Function | Meaning | Equivalent Statement |
|---|---|---|
| \(\exp(a)\) | Natural Exponential Function | \(e^a\) |
| \(\ln(a)\) | Natural Logarithm | \(\log_e(a))\) |
| \(\log(a)\) | Common Logarithm | \(\log_{10}(a)\) |
| \(\log_b(a)\) | Logarithm | \(\frac{\int_1^a\frac1t\text{dt}}{\int_1^b\frac1t\text{dt}}\) |
| \(\operatorname{total}(L)\) | Sum of all values in list | \(\sum L\) |
| \(\operatorname{count}(L)\) | Number of elements in list | \(L=[L_1,\ldots,L_n];n\) |
| \(\operatorname{mean}(L)\) | Arithmetic Mean | \(\frac{1}{n}\sum_{k=1}^nL_k\) |
| \(\operatorname{mean}(x_1,\ldots,x_n)\) | Arithmetic Mean | \(\frac{1}{n}\sum_{k=1}^nx_k\) |
| \(\operatorname{median}(L)\) | Statistical Median | \(\begin{cases}(L.\kern-.15em\operatorname{sort})_\frac{n+1}{2} & n\text{ is odd}\\\frac{1}{2}\big((L.\kern-.15em\operatorname{sort})_\frac{n}{2}+(L.\kern-.15em\operatorname{sort})_\frac{n+1}{2}\big) & n\text{ is even}\end{cases}\) |
| \(\operatorname{median}(x_1,\ldots,x_n)\) | Statistical Median | \(L=[x_1,\ldots,x_n];\\\begin{cases}(L.\kern-.15em\operatorname{sort})_\frac{n+1}{2} & n\text{ is odd}\\\frac{1}{2}\big((L.\kern-.15em\operatorname{sort})_\frac{n}{2}+(L.\kern-.15em\operatorname{sort})_\frac{n+1}{2}\big) & n\text{ is even}\end{cases}\) |
| \(\operatorname{quartile}(L, q)\) | Moore and McCabe Quartile | \(\begin{cases}\frac{n+1}{4} & n\text{ is odd and }q=1\\\frac{3n+3}{4} & n\text{ is odd and }q=3\\\frac{n+2}{4} & n\text{ is even and }q=1\\\frac{3n+2}{4} & n\text{ is even and }q=3\\\end{cases}\) |
| \(\operatorname{nCr}(n,r)\) | Binomial Coefficient | \(\prod_{i=1}^r\frac{n+1-i}{i}\) |
| \(\operatorname{nPr}(n,r)\) | r-permutation of n | \(\frac{n!}{(n-k)!}\) |
| \(\operatorname{stdev}(L)\) | Standard Deviation | \(\sqrt{\frac1{n-1}\sum_{i=1}^n(L_i-L.\kern-.15em\operatorname{mean})^2}\) |
| \(\operatorname{stdev}(x_1,\ldots,x_n)\) | Standard Deviation | \(\sqrt{\frac1{n-1}\sum_{i=1}^n(x_i-\operatorname{mean}(x_1,\ldots,x_n))^2}\) |
| \(\operatorname{stdevp}(L)\) | Population Standard Deviation | \(\sqrt{\frac1n\sum_{i=1}^n(L_i-L.\kern-.15em\operatorname{mean})^2}\) |
| \(\operatorname{stdevp}(x_1,\ldots,x_n)\) | Population Standard Deviation | \(\sqrt{\frac1n\sum_{i=1}^n(x_i-\operatorname{mean}(x_1,\ldots,x_n))^2}\) |
| \(\operatorname{mad}(L)\) | Mean Absolute Deviation | \(\frac1n\sum_{i=1}^n\left|L_i-L.\kern-.15em\operatorname{mean}\right|\) |
| \(\operatorname{mad}(x_1,\ldots,x_n)\) | Mean Absolute Deviation | \(\frac1n\sum_{i=1}^n\left|x_i-\operatorname{mean}(x_1,\ldots,x_n)\right|\) |
| \(\operatorname{var}(L)\) | Variance | \(\frac1{n-1}\sum_{i=1}^n(L_i-L.\kern-.15em\operatorname{mean})^2\) |
| \(\operatorname{var}(x_1,\ldots,x_n)\) | Variance | \(\frac1{n-1}\sum_{i=1}^n(x_i-\operatorname{mean}(x_1,\ldots,x_n))^2\) |
| \(\operatorname{varp}(L)\) | Population Variance | \(\frac1n\sum_{i=1}^n(L_i-L.\kern-.15em\operatorname{mean})^2\) |
| \(\operatorname{varp}(x_1,\ldots,x_n)\) | Population Variance | \(\frac1n\sum_{i=1}^n(x_i-\operatorname{mean}(x_1,\ldots,x_n))^2\) |
| \(\operatorname{cov}(A,B)\) | Covariance | \(\sum_{i=1}^n\frac{(A_i-A.\operatorname{mean})(B_i-B.\operatorname{mean})}{N-1}\) |
| \(\operatorname{covp}(A,B)\) | Population Covariance | \(\sum_{i=1}^n\frac{(A_i-A.\operatorname{mean})(B_i-B.\operatorname{mean})}N\) |
| \(\operatorname{corr}(A,B)\) | Pearson Correlation Coefficient | \(\frac{\operatorname{cov}(A,B)}{\operatorname{stdev}(A)\operatorname{stdev}(B)}\) |
| \(\operatorname{spearman}(A,B)\) | Spearman's Rank Correlation Coefficient | \(C=[1,\ldots,A.\kern-.15em\operatorname{count}].\kern-.15em\operatorname{sort}(A)\\D=[1,\ldots,B.\kern-.15em\operatorname{count}].\kern-.15em\operatorname{sort}(B)\\\operatorname{corr}(C,D)\) |
| \(\operatorname{lcm}(L)\) | ||
| \(\operatorname{lcm}(x_1,\ldots,x_n)\) | ||
| \(\operatorname{gcd}(L)\) | ||
| \(\operatorname{gcd}(x_1,\ldots,x_n)\) | ||
| \(\operatorname{mod}(a,n)\) | Remainder of Integer Division | \(a-n\left\lfloor\frac an\right\rfloor\) |
| \(\operatorname{floor}(a)\) | Round down | |
| \(\operatorname{ceil}(a)\) | Round up | |
| \(\operatorname{round}(a)\) | Round | |
| \(\operatorname{round}(a,b)\) | Round to \(b\) decimal places | |
| \(\operatorname{abs}(a)\) | Absolute Value | \(\begin{cases}a&a\ge0\\-a&a\lt0\end{cases}\) |
| \(\operatorname{min}(L)\) | Least element of \(L\) | |
| \(\operatorname{min}(x_1,\ldots,x_n)\) | Least of \(x_1,\ldots,x_n\) | |
| \(\operatorname{max}(L)\) | Greatest element of \(L\) | |
| \(\operatorname{max}(x_1,\ldots,x_n)\) | Greatest of \(x_1,\ldots,x_n\) | |
| \(\operatorname{sign}(a)\) | Signum | \(\begin{cases}-1&a<0\\0&a=0\\1&a>0\end{cases}\) |
| \(\sin(a)\) | Trigonometric Sine | \(\sum_{n=1}^\infty\frac{(-1)^{n-1}}{(2n-1)!}a^{2n-1}\) |
| \(\cos(a)\) | Trigonometric Cosine | \(\sum_{n=1}^\infty\frac{(-1)^{n}}{(2n)!}a^{2n}\) |
| \(\tan(a)\) | Trigonometric Tangent | \(\frac{\sin a}{\cos a}\) |
| \(\csc(a)\) | Trigonometric Cosecant | \(\frac1{\sin a}\) |
| \(\sec(a)\) | Trigonometric Secant | \(\frac1{\cos a}\) |
| \(\cot(a)\) | Trigonometric Cotangent | \(\frac1{\tan a}\) |
| \(\sinh(a)\) | Hyperbolic Sine | \(\frac12(e^a-e^{-a})\) |
| \(\cosh(a)\) | Hyperbolic Cosine | \(\frac12(e^a+e^{-a})\) |
| \(\tanh(a)\) | Hyperbolic Tangent | \(\frac{\sinh a}{\cosh a}\) |
| \(\operatorname{csch}(a)\) | Hyperbolic Cosecant | \(\frac1{\sinh a}\) |
| \(\operatorname{sech}(a)\) | Hyperbolic Secant | \(\frac1{\cosh a}\) |
| \(\coth(a)\) | Hyperbolic Cotangent | \(\frac{\cosh a}{\sinh a}\) |
| \(\arcsin(a)\) | ||
Subsitution using with
List Operations
Special Indexing
Lists are indexed by by surrounding an index with \([\) and \(]\) after a list.
| Note |
|---|
| Contrary to a programmer's first instinct, indices begin at one, not zero. |
Assume the following variables in the table
\[L_1=[1...10]\\L_2=[1,3...9]\\j=3\]
| Indexing | Copyable | Purpose | Result |
|---|---|---|---|
| \(L_1[j]\) | L_1\left[j\right] | Standard indexing: Gets the \(j\)-th index of the list | \(3\) |
| \(L_1[L_2]\) | L_1\left[L_2\right] | Get elements, where indices are defined by a list. | \([1,3,5,7,9]\) |
| \(L_1[1\dots\kern2px j]\) | L_1\left[1...j\right] | Gets all elements from \(1\) to \(j\), in a list | \([1,2,3]\) |
List Broadcasting
List broadcasting allows for lists to interact with scalar values and other lists. Additionally, a list can be passed into a function which would normally only accept a scalar value, and the value will be broadcasted into the function. This causes the function to be called on each element of the list, and then to return a list of each output.
Assume the following variables in the table:
\[L=[1,2,3]\\L_2=[4,5,6]\]
| Example | Copyable | Output |
|---|---|---|
| \(L^2\) | L^2 | \([1,4,9]\) |
| \(\operatorname{mod}(L,2)\) | \operatorname{mod}\left(L,2\right) | \([1,0,1]\) |
| \(\operatorname{mod}(L)+1\) | \operatorname{mod}\left(L\right)+1 | \([4,5,6]\) |
| \(L_2-L\) | L_2-L | \([3,3,3]\) |
List Comprehension
Actions
The Ticker
Regression
Piecewise
Piecewise Alternatives
Recursion
Special Functions
Special Functions
Scale variables
The viewport's width and height can be accessed in logical pixels. This allows for creating dynamic (mobile-friendly) graphs.
| Variable | Copyable | Use |
|---|---|---|
| \(\operatorname{width}\) | \operatorname{width} | Width in Logical Pixels |
| \(\operatorname{height}\) | \operatorname{height} | Height in Logical Pixels |
External Tools
Thank you to the following contributors...
- Will N