The left graph below is the domain coloring graph of $w=f(z)$. Here, at the point $z$, the hue and brightness are $\arg(w)$ and $|w|$ respectively (red is $\arg(w)=0$, black is $|w|=0$, white is $|w|=\infty$).

The right graph, provided for reference, is the baseline color graph, corresponding to $w=z$. For a sense of scale, the unit circle is drawn. Enter the complex function $f(z)$ in the text box then hit < tab > to graph it. For complex number syntax, see below.

Enter monomials, polynomials, rational functions, $e^z$, etc. The graph bounding box dimension is $2b\times 2b$. By adjusting $b$, zoom in to and out of poles and zeros located at the origin.

SageMath code below is in `blue`

boxes.

Lowercase, uppercase, camelcase.

`show(...)`

displays the result, whether it is a number, an equation, a graph, a surface, etc.

Addition `a + b`

, subtraction `a - b`

, multiplication `a * b`

, division `a / b`

, mod `a % b`

, powers `a ^ b`

, and *parentheses* `(...)`

. For example,

show(5 + 14) show(15 * 10) show(23 % 5) show(46 / 10)outputs \(19\) and \(150\) and \(3\) and \(23/5\).

To convert a number `a`

to a decimal with `n`

digits, write `N(a,digits=n)`

. For example, the code

a = 1234/1728 show(a) a = N(a,digits=20) show(a)outputs \(617/864\) and \(0.71412037037037037037\).

The code

a = sqrt(25) b = sqrt(1234/1728) c = N(b,digits=40) show(a) show(b) show(c)outputs \(5\) and \(\dfrac1{12}\sqrt{\dfrac{617}6}\) and \(0.8450564302875698314535479970302979455774\).

Equal `a == b`

, not equal `a != b`

, less than `a < b`

, greater than `a > b`

, less or equal `a <= b`

, greater or equal `a >= b`

. The code

show(5^2 == 25) show(15 != 10) show(15 <= 10)outputs "True" and "True" and "False".

`if <`

is a *conditional*>:*header* announcing the start of an *if block* of code. The code block after the header is executed if the conditional is True. The code block after the header is always *indented*:

if d^2 > 9: ... first line of code block ... second line of code block

`[a,b,c,...]`

(enclosed in *brackets*).

`range(5)`

is the same as `0,1,2,3,4`

and `range(2,9)`

is the same as `2,3,4,5,6,7,8`

.

`for i in range(5):`

and `for i in range(2,9):`

are *headers* announcing the start of a *for block*. The code block after the header is executed repeatedly with the *index* `i`

taking sequentially the values in the range.
The code block after the header is always *indented*:

for i in range(2,9): ... first line of code block ... second line of code block

This is how SageMath stores the data in a drawing of a point, a line, a graph, a surface, etc. It is stored in the computer as a *graphics object*. Graphics objects `A`

, `B`

, `C`

, etc. may be combined by writing
`A + B + C + etc`

. Graphics objects are displayed using `show`

.

`f(x) = x^2*sin(x)`

or `g(x,y)= x^2*sin(x*y)`

are functions. Evaluate functions using `a = f(x=2)`

or `b = g(x=3)`

. Then `show(a)`

results in \(4\sin2\) and `show(b)`

results in \(9\sin(3y)\).

Sometimes `x`

is a *constant*, sometimes `x`

is a *variable*. The code

x = 2 show(x)outputs \(2\). Here

`x`

is a `x`

is \(2\).
The code

var('x') show(x)outputs \(x\). Here

`x`

is a `var('x','y','a')`

defines three variables `x`

, `y`

, `a`

. Defining a function `f(x) = x^2`

automatically makes `x`

a variable.
The code

f(x) = x^2 m = 2 b = 4 var('y') show(y == m*x+b) show(y == f(x))outputs the equations \(y=2x+4\) and \(y=x^2\). Equations can be given names, for example

var('x','y') eq = y == 2*x+4 show(eq)outputs \(y=2x+4\).

`P = point((x,y))`

creates a graphics point `P`

corresponding to the point \((x,y)\). To draw it, use `show(P)`

.
For multiple points, use ` points(L)`

where `L`

is a list of points.

`G = plot(f(x),(x,a,b))`

creates a graphics plot `G`

corresponding to the plot of the function \(f(x)\) over the interval \(a\le x\le b\).
To draw it, use `show(G)`

.

`G = polar_plot(f(theta),(theta,a,b))`

creates a graphics plot `G`

corresponding to the plot of the function \(f(\theta)\) over the interval \(a\le \theta\le b\).
To draw it, use `show(G)`

.

`G = plot3d(f(x,y),(x,a,b),(y,c,d))`

creates a graphics plot `G`

corresponding to the plot of the function \(f(x,y)\) over the region \(a\le x\le b\), \(c \le y \le d\).
To draw it, use `show(G)`

.

Complex numbers are written as usual `x+y*i`

or `r*e^(i*theta)`

. The code `abs(z)`

, `arg(z)`

yield the absolute value, argument of $z$, `conjugate(z)`

is the conjugate of $z$, and `z.real()`

, `z.imag()`

are the real and imaginary parts of $z$.

The code `complex_plot(f, (a,b),(c,d))`

draws the complex function \(f(z)\) over the region \(a\le x\le b\), \(c\le y\le d\).
Here the brightness is $r$ ($r=0$ is black) and the hue is $\theta$ ($\theta=0$ is red), where $f(z)=re^{i\theta}$.

To plot multiple functions \(f,g,h\) at the same time, enter them into `plot`

or `plot3d`

etc. as a list `[f,g,h]`

.

`line([(x_1,y_1),(x_2,y_2)])`

creates a graphics line segment corresponding to the line segment joining the points \((x_1,y_1)\) and \((x_2,y_2)\). Notice the two points are inside a list `[...]`

. Can have more than two points, for example, if `L=[a,b,c,d]`

is a list of four points, then `show(line(L))`

draws the line segments joining the points \(a\), \(b\), \(c\), \(d\) in order.

Write `derivative(f,x)`

or `Df(x) = derivative(f,x)`

.
To show it, write `show(derivative(f,x))`

or `show(Df(x))`

.

A *string* is any sequence of characters enclosed in quotes `'...'`

, for example `'alpharomeo'`

. The string `'2'`

is different than the number `2`

.

You can add color to a plot by writing `plot(f,x,a,b,color='blue')`

.
You can add a label `'alpharomeo'`

to a plot by writing `plot(f,x,a,b,legend_label='alpharomeo')`

.