Complex polynomial toy (with derivatives) documentation
This is the documentation for the complex polynomial toy (with derivatives), an interactive program for domain coloring of polynomials and their derivatives, along with a feature to experiment with the idea behind a proof that every non-constant polynomial has at least one complex root. Plotting derivatives is meant to illustrate the Gauss-Lucas theorem.
The program was created September 2018 as a modification of an earlier program with only domain coloring. A version with an expanded palette of functions is zgraph.
This documentation has been barely modified from earlier documentation.
1. Basic usage
Type in a polynomial (for instance, x(x+2i)^2+1) in the text box in the upper left corner and press Enter. Drag the radius of the circle () on the left side around to see its image () on the right.
One reason every polynomial has a root is that for large radii the image will wrap around zero times, but for very small radii the image will wrap tightly around — and, if it is not already the case that , somewhere in between the image must pass through zero. Arrow keys animate the domain coloring.
- Left click
- Places the radius point for the circle.
- Right click
- Places the center point for the circle.
- Scroll wheel
- Moves the radius point around the center.
- Left arrow and Right arrow
- Adjust the animation speed of the argument coloring. Right arrow makes the rainbow rotate counterclockwise around zeros.
- Down arrow and Up arrow
- Adjust the animation speed of the contour lines. Up arrow makes the contours move away from zeros.
2. Details
This is a description of the earlier version of the program. This particular version uses domain coloring of a polynomial of a polar grid superimposed on the domain coloring of the derivative of the polynomial.
The left view is the domain of the polynomial, and the right view is the codomain. For the codomain, as in an Argand diagram, each pixel corresponds to a particular complex number, where the hue represents the argument of the complex number, and where the magnitude is represented via gray contours of constant magnitude. The contours are logarithmically spaced, meaning the magnitude changes by a constant multiplicative factor between consecutive contours.
For the domain, each pixel is colored by “pulling back” the coloring of the codomain through the polynomial . Concretely, to color a given a pixel, consider its corresponding complex number , calculate , and see what color would lie under in the codomain.
The codomain has a hue singularity at , where the rainbow wraps around it once. Everywhere you see a similar hue singularity in the domain you are seeing a root of the polynomial. You can experiment with this by moving around the radius of the circle as a test point, since its position in the codomain is its image.
Some things to try:
- x-(1+2i) to place a root at .
- (x-1)(x+1)(x-i)(x+i) to place roots at .
- 1-x^3 to place roots at third roots of unity.
- x^2 to see how the circle gets wrapped twice around . (Scroll to rotate the radius point.)
- 1+x+x^2+x^3+x^4+x^5+x^6+x^7+x^8+x^9+x^10+x^11+x^12+x^13+x^14+x^15 +x^16+x^17+x^18+x^19+x^20+x^21+x^22 as an approximation of the Taylor series of centered at . This is a Möbius transformation, but the Taylor series is only valid within its radius of convergence. Notice that this partial sum is , so the radius of convergence is governed by the rd roots of unity. Try changing the number of terms.
- 1+x+x^2/2+x^3/6+x^4/24+x^5/120+x^6/720+x^7/5040+x^8/40320+x^9/362880 +x^10/3628800+x^11/39916800+x^12/479001600+x^13/6227020800+x^14/87178291200 +x^15/1307674368000+x^16/20922789888000+x^17/355687428096000 +x^18/6402373705728000+x^19/121645100408832000+x^20/2432902008176640000 +x^21/51090942171709440000+x^22/1124000727777607680000 as an approximation of the Taylor series of . Try reducing the number of terms to see the positions of the roots for the approximation.
The roots of the derivative appear in the form of cusps on the image curve.
3. The fundamental theorem of algebra
Polynomials are what you get through addition, subtraction, and multiplication of constants and unknowns. Many problems come down to finding roots, the values you can assign to the unknown so that polynomial evaluates to . Some polynomials apparently have no roots, for instance , which is positive for all real numbers . Like the invention of negative numbers, we can just imagine this polynomial to have roots at some imaginary numbers, and , where is formally the square root of .
This is not particularly intuitive on the face of it, but there is some intuition to be found.
Question: what does multiplication by really do to the number line? The first option is that we imagine multiplication by reflects the number line through , which is a defensible position. But consider the second option, where multiplication is rotation by through something outside the real numbers. The square root of a rotation by is counterclockwise rotation by or by , since performing such a quarter turn twice yields a half turn.
The complex numbers are a two-dimensional number system extending the real numbers with additional numbers for rotations. Multiplication by a real number corresponds to scaling the real line, whereas multiplication by complex numbers corresponds scaling and rotation of the complex plane.
Where real numbers can be thought of as being transformation matrices, one way to imagine complex numbers is as transformations matrices that are linear combinations of a scaling matrix and a rotation matrix. Every such matrix is of the form
which is a linear combination of the identity matrix and a rotation by counterclockwise. In the terser, more classical notation, this is represented as . Polar form is the representation of a complex number as a product (rather than a sum) of a scaling matrix and a rotation matrix, where we define , whose matrix is rotation by counterclockwise.The vague intuition is that the additional rotations let us go around things, letting us encircle and thereby bind the roots for us to isolate. The real numbers merely gave us the power to sometimes be on the other side of something (giving the Intermediate Value Theorem).
For varying , traces out a circle on the complex plane, where we plot numbers as points . We can feed this circle to a polynomial, yielding some closed loop . The winding number of the loop is the net number of times this loop wraps around , assuming the loop does not pass through , where we count counterclockwise wrappings positively and clockwise wrappings negatively. There is a line integral to calculate winding number. For large enough , one can show that the winding number equals the degree of the polynomial (the largest exponent in the expanded form of the polynomial). For , the winding number is , supposing . Since the winding number is an integer, somewhere in between a catastrophe must occur, where the closed loop actually passes through . This is indicates a root.
4. Language reference
The program accepts standard computer math notation for expressions that are a polynomial in the variable . Due to the way the program is implemented, the maximum degree for polynomials is arbitrarily set to . For the following language description, let a and b represent valid expressions.
- x
- The variable the expression is a function of.
- a sequence of digits 0–9 with at most one decimal point
- Interpreted as the corresponding floating-point number.
- i
- The imaginary unit , which we imagine to be ninety degrees counterclockwise from .
- a + b
- Addition.
- a - b
- Subtraction.
- -a
- Negation.
- +a
- Unary plus (no effect).
- a b or a * b
- Multiplication.
- a / b
- Division, where b must be a nonzero constant.
- a ^ b
- Exponentiation, where b must be a non-negative integer constant.
- (a)
- Parenthetical grouping.
This is the formal grammar:
sum = ["+"|"-"] prod {("+"|"-") prod}. prod = exp {["*"|"/"] exp}. exp = term ["^" "num"]. term = "(" sum ")" | "num" | "x" | "i".