Complex Grapher Documentation

Complex Grapher is an online tool to visualize complex functions using domain coloring. This help guide assumes basic knowledge about how complex numbers and domain coloring work, Wikipedia links will be provided for further explanation.

Complex Grapher requires a browser that supports WebGL 3.0 or greater.

The user interface


level0 := level1 (("+" | "-") level1)*
level1 := level2 (("*" | "/") level2)*
level2 := (level3 "^")* level3
level3 := "(" level0 ")"
    | "{" condition "}"
    | name "(" (level0 ",")* level0 ")"
    | name
    | imag
    | real
    | "-" level1
condition := level0 ":" level0 "," condition
    | level0
name := /[a-zA-Z_√Γπτγ]+/
real := number
imag := number "i"
number := ("+" | "-")? digits "." digits
    | ("+" | "-")? digits "."
    | ("+" | "-")? "." digits
    | ("+" | "-")? digits
digits := /[0-9]+/
whitespace = /[ \t\n\r]*/


Real numbers can be written in standard base-10 form (ex. 37, -1045, 33.26258). Imaginary numbers can be written similarly, but followed by an i (ex. 3i, -25i, .37i). i can also be used alone. Complex numbers can be expressed simply as the sum of a real and an imaginary number (ex. 3-5i, .7+52i).


The five basic operators are +, -, *, /, and ^ (exponentiation). These follow the normal order of operations, with ^ being right associative (so 2^3^4 = 2^(3^4), not (2^3)^4). Parentheses ( ) can be used for grouping.

Variables and constants

In f(z), the variables z, c, and n are available. z is the argument of the function, and c and n are used for iteration as described above. In z₀(z) and c(z), the only variable available is z.

The constants e, tau or τ, pi or π (= τ/2), and emg or γ (the Euler–Mascheroni constant) are available


Functions are written as the funciton name followed by the argument in parentheses. All functions only take one argument. Examples: sin(z), gamma(3+2i), conj(1/z).

The following functions are available:

The following functions are currently experimental and may be changed or removed later:


Conditionals (using curly braces { }) can be used like if-statements to pick an expression from a list. They take the form {condition1: expression1, condition2: expression2, expression3}. The conditions are evaluated from left to right, once the first true one is reached the corresponding expression is evaluated. The final expression (with no condition) acts as a fallback if none of the previous conditions were true. A condition is true if the real part of the result is strictly positive.

Example: {z-3: 2*z, z-2: z^2, 1/z} will evaluate to 2*z whenever re(z)>3 (re(z-3)>0), otherwise to z^2 whenever re(z)>2, otherwise to 1/z.

Conditionals are currently experimental and may be changed later.

A word of caution

WebGL is very prone to crashing, especially when using iteration. Some operations, like addition and multiplication, are very fast and should not cause too many problems. Others, like exp(z) and sinh(z) are fairly fast since they are implemented directly in the hardware. But some functions, like lambertw(z) and gamma(z) are a lot slower due to their slow implementations. For the best performance, avoid mixing slow functunctions, high iteration counts, and high DPI settings together.

Example graphs