Advanced Techniques with Complex Numbers

While our Complex Numbers article offers an introduction to complex numbers in Desmos tools, you can read this article to learn more advanced techniques. Some advanced techniques with complex numbers include using complex numbers in 3D, sorting complex values, and taking derivatives involving complex numbers.

 

Complex Numbers in 3D

In the 3D Calculator, complex numbers aren’t immediately plotted as they are in the Graphing Calculator. However, you can still use them when performing calculations or plotting surfaces.

In the example graph, the 3D surface in the second line represents the magnitude of a function of all complex numbers of the form \(x+yi\). By adjusting the slider, you can explore how the surface intersects the plane \(z=0\). These intersection points correspond to the zeros of the function.

For this specific function, the zeros appear on both the \(x\)-axis and \(y\)-axis:

  • Zeros on the \(x\)-axis are real zeros because when \(y=0\), the complex number \(x+yi\) simplifies to \(x+0i\), which can be written as the real number \(x\).
  • Zeros on the \(y\)-axis are complex zeros because when \(x=0\), \(x+yi\) simplifies to \(0+yi\), which is a complex number.
Screenshot of the magnitude of the function w squared plus a evaluated at x plus yi with the real and imaginary versions of the function graphed when equal to zero.

 

Number Theory Functions on Complex Numbers

In Desmos, complex numbers are expressed using real coefficients for both their real and imaginary parts. For example, in the complex number \(2.9+3.7i\), \(2.9\) is the real part, and \(3.7\) is the imaginary part. Since some functions involving complex numbers lack universal conventions, the following table explains how Desmos handles number theory functions on complex numbers.

Function Try Typing... This Function...
round round\(\mathbf{(2.9+3.7i)}\) rounds the coefficients of the real and imaginary part of the number.
floor floor\(\mathbf{(2.9+3.7i)}\) computes the complex floor function.
ceil ceil\(\mathbf{(2.9+3.7i)}\) computes the complex ceiling function, which you can find with \(-\)floor\((-z)\).
mod mod\(\mathbf{(2.9+3.7i,3i)}\) computes the modular function with the equation mod\((a,b) = a - b\) • floor\((\frac{a}{b})\).
gcd gcd\(\mathbf{(4+2i, 1-3i)}\) finds the number in the first quadrant with the largest magnitude that divides both numbers.
lcm lcm\(\mathbf{(4+2i, 1-3i)}\) finds the number in the first quadrant with the smallest magnitude that is a multiple of both numbers.

 

Floor Function

In Desmos, the floor function always returns a number that is one unit away from the original number at most. For complex numbers, this means the floor function outputs one of three options:

  1. floor\((x+yi)=\)floor\((x)+\)floor\((y)i\)
  2. floor\((x+yi)=\)floor\((x)+\)floor\((y)i+1\)
  3. floor\((x+yi)=\)floor\((x)+\)floor\((y)i+i\)

Open the example graph and drag the point to see how the position of the complex number affects the floor value.

Since complex numbers are not ordered, there are multiple possible definitions of the floor function. The method Desmos uses is attributed to E.E. McDonnell.

Gif of moving a complex point throughout the graph and showing how the floor function changes

Comparisons and Ordering

Two complex numbers are considered equal if and only if their real and imaginary parts are both equal.

Due to the complex number system lacking a total ordering, non-strict inequalities \((\lt\) or \(\gt)\) involving complex numbers with non-zero imaginary parts will always be undefined. Strict inequalities \((\leq\) or \(\geq)\) are only defined when the two numbers are equal or the corresponding non-strict inequality is defined.

Complex numbers with a zero imaginary part (such as \(3+0i\)) are treated as real numbers and can be compared to other real numbers.

Functions like min, max, median, quartile, and quantile are undefined for complex numbers. However, you can still sort a list of complex numbers. The sort function compares the real parts first, and if any two numbers have equal real parts, the sort function will then compare the imaginary parts.

 

Derivatives of Complex Numbers

For complex numbers, Desmos uses the Wirtinger derivative. This approach allows you to take the derivative of functions like abs, real, imag, and conj, which are not complex differentiable (or not holomorphic).

Occasionally, the Wirtinger derivative of a function evaluated at \(a+0i\) gives a different value than the derivative evaluated at a. In such cases, an error will appear in the expression list.

 

Learn More

Please reach out with any questions or suggestions at support@desmos.com.