Source Code
Table of Contents
Complex Visual Plots
This project contains files for visualizing complex functions. Given such
a function \(f:\mathbb{C}\rightarrow\mathbb{C}\) we can paint the point
\(z\in\mathbb{C}\) by giving it a color corresponding to the argument
\(\textrm{Arg}\big(f(z)\big)\) and the intensity given by the modulus
\(|f(z)|\). For a function like \(f(z)=z^{3}-1\) we get the following.
There are also routines to iteratively compute functions over and over. This
can help visual how Newton fractals occur. The polynomial \(f(z)=z^{3}-1\) has
Newton perturbation given by
\begin{equation}
p(z)=z-\frac{f(z)}{f’(z)}=z-\frac{z^{3}-1}{3z^2}=\frac{2z^{3}+1}{3z^{2}}
\end{equation}
By defining \(p_{0}(z)=p(z)\) and \(p_{n+1}(z)=p(p_{n}(z))\) we can see how
Newton fractals form (which correspond to \(p_{\infty}\)). Three iterations
yield the following plot.
Lastly, the Mandelbrot set can be described by the recursive definition
\(w_{0}=z\), \(w_{n+1}=w_{n}^{2}+z\). Performing a finite number of iterations
can help us see how the Mandelbrot set starts to form. Six iterations yields
the following image.
Benchmarks
Language | Implementation | Time (s) | Version |
---|---|---|---|
C | gcc | 0.061 | gcc (Debian 10.2.1-6) 10.2.1 20210110 |
C | clang | 0.061 | Debian clang version 11.0.1-2 |
C++ | g++ | 0.087 | g++ (Debian 10.2.1-6) 10.2.1 20210110 |
C++ | clang++ | 0.105 | Debian clang version 11.0.1-2 |
C | pcc | 0.146 | Portable C Compiler 1.2.0.DEVEL 20200630 |
C | tcc | 0.186 | tcc version 0.9.27 |
Go | golang | 1.364 | go 1.15.15 |
Go | gccgo | 1.645 | gccgo (Debian 10.2.1-6) 10.2.1 20210110 |
These benchmarks are for rendering three iterations of Newton’s method (the second image).