Log a (b)

Complex Numbers Graphing
Julius Won
June 11 2022

A normal equation can be graphed on a 2d surface. It represents the input with the x axis and the output with the y axis. You can think of it like the computer looping over each point in the input direction and plugging it into the function, then creating a new place in the graph at that x coordinate and the y coordinate of the functions evaluation.

This assumes each input is 1 value, and that it can be represented by 1 number. But this falls apart for a specific use case: Complex numbers. A complex number is a number with one part real (just a regular number) and one part imaginary (sqrt(-1), also called “i”). These numbers are often represented in the form a+bi where a is the real part and b is the imaginary part. Where real numbers are placed on a number line, these complex numbers are placed on a 2d plane, called the complex plane.

To graph with this means that (1): the program has to consider a 2d dimensional input, (2) the program has to represent a 2 dimensional output, and (3) be able to evaluate these inputs. This means that the program has to represent 4 values for each point in the graph; the real part of the input, the imaginary part of the input, the real part of the output, and the imaginary part of the output. Add them up; that’s 4 values, which needs 4 axis/dimensions.

I wrote this program a while back, it can graph most functions (except logarithms for some reason) and represents them in 4 dimensions. It uses x,y, and z, making it a 3d, but also is essentially animated, making the 4th value represented by the passage of time.


sine function


cubic poynomial function


exponential function

Source Code