Plotting complex functions with Julia
2021-03-27
TLDR: scroll down for cool 3D plots.
Mathematical introduction
In this post we wish to visualize complex valued functions of a single complex variable, i.e. functions
that is look at e::ach number
How can we do this for complex valued functions?
Recall that a complex number
While we can't see the whole graph of the function, we can still get part of the way there. One approach to visualizing a complex function is using domain coloring. In this post, we will aim to instead visualize the modulus of a complex function.
Recall that for any complex number
Using Julia for plotting
Since we now know that for a complex function
- It supports complex numbers for the complex valued functions we will want to visualize (e.g. sums, exponents,
...), and - it can use plotly to create nice interactive 3D plots that can be shared in the browser.
See here for an introduction to plotting with Julia.
One last comment before we get to the plotting: taking the modulus can result in very large numbers, making it hard to see the structure for smaller values, we therefore plot scaled versions using
- First we plot the modulus of the polynomial
, or rather , giving the following 3D graphic:
Recognize the 6 zeros of the function, as we would expect from the fundamental theorem of algebra.
- Next we plot the meromorphic function
:
- Now we turn to
:
Notice the essential singularity at
- Next let's look at
:
where we can see that, while the zeros along the real line repeat with period
- We can also plot the Gamma function
:
- Finally, we visualize the Riemann zeta function
:
Notice the zeros lining up on the
We've now seen many 3D plots of the modulus of a complex function. Hopefully this should give you some sort of new intuition for how complex valued functions behave. To really complete the vizualisations done here, one should also plot the argument
If the visualisation of complex functions interest you, you may consider checking out the following links: