ChristensenSet.jl Documentation
A computation of Christensen sets in Julia.
What is Christensen's set?
Let us consider a finite set of complex numbers $K$ and a positive integer $n$. Then the Christensen set $C_{K, n}$ is the set of all roots of univariate polynomials with coefficients from $K$ and degree at most $n$. It is a subset of the complex plane and it is easy to visualize its density.
This Julia package is motivated by the John Baez's article and Dan Christensen's experiments. It employs the PolynomialRoots.jl package for root finding.
A few beautiful fractal images can be found in the Gallery.
Polynomial iterator
ChristensenSet.PolynomialIterator
— TypePolynomialIterator(coefficients, degree)
Iterate over all polynomials with coefficients provided by array coefficients
and maximal degree degree
.
Polynomials are represented by arrays of their coefficients from the lowest to the highest order (as in the PolynomialRoots package). For example, the polynomial $z^2 + 2z + 3$ corresponds to the array [3, 2, 1]
.
The constructor removes duplicate values from the coefficients
array.
Roots image
ChristensenSet.RootsImage
— TypeRootsImage(leftbottom, topright, width, height)
Essentially a two dimensional histogram covering a rectangle in the complex plane specified by complex numbers leftbottom
and topright
with width
horizontal and height
vertical bins.
Computing roots
ChristensenSet.find_roots!
— Functionfind_roots!(poly_iter, image)
Find all roots of polynomials generated by polynomial generator poly_iter
and draw these roots directly onto image
(see add_root!
). Ignores zero as a root, it occurs too many times and is not that interesting.
This function heavily relies on roots
from the PolynomialRoots package.
find_roots!(poly_iter, filename)
Find all roots of polynomials generated by polynomial generator poly_iter
and save these roots into filename
in binary form. Ignore zero as a root, it occurs too many times and is not interesting.
This function heavily relies on roots
from the PolynomialRoots package.
Ploting
ChristensenSet.save_image
— Functionsave_image(img, filename[; mode])
Save the img
to file filename
. Optional parameter mode
has the same meaning as in the plot
function.
ChristensenSet.fill_image!
— Functionfill_image!(img, filename)
An analog of fill_images!
, only with one image.
ChristensenSet.fill_images!
— Functionfill_images!(imgs, filename)
Read roots from file filename
and draw them onto images contained in the array imgs
.
ChristensenSet.animate_growth
— Functionanimategrowth(polyiter, img, filename[; output_filename])
Take roots of polynomials generated by poly_iter
and saved in file filename
and draw them incrementaly (each step corresponds to change of degree) onto image img
.
ChristensenSet.plot
— Functionplot(img[; mode])
Show a graphical representation of the image img
. The optional parameter mode
controls how to scale number of roots in histogram bins:
:sharp
,:log
,:log_cutoff
,:linear
,- a function.