https://github.com/expandingman/mandelbrot.jl
goofing off with the mandelbrot set in Julia
https://github.com/expandingman/mandelbrot.jl
Last synced: 6 months ago
JSON representation
goofing off with the mandelbrot set in Julia
- Host: GitHub
- URL: https://github.com/expandingman/mandelbrot.jl
- Owner: ExpandingMan
- Created: 2020-04-25T03:58:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-25T19:44:13.000Z (about 6 years ago)
- Last Synced: 2025-01-21T10:07:51.662Z (over 1 year ago)
- Language: Julia
- Homepage:
- Size: 6.08 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mandelbrot
Some simple, fun Julia code for generating Mandelbrot set related imagery. This was
basically a "weekend project" and is more of a nice demonstration of
[Julia](https://julialang.org) than anything else.
Everything here works simply by mapping the values of individual pixels. As such, the
images may look a little "grainy" depending on how many iterations are used. This can be
remedied either by doing more iterations (or plotting more points) or with some sort of
image post-processing.
## Simple Uses
One can check if a complex number `z` (specifically, any Julia `Number`) is in the mandelbrot
set by doing
```julia
using Mandelbrot
z ∈ mandelbrot
```
By default membership in the set is estimated from 10^3 iterations (without any tests for
convergence). One can change the number of iterations by doing `∈(z, mandelbrot,
n_iter)`.
One can generate the so-called "[buddhabrot](https://en.wikipedia.org/wiki/Buddhabrot)"
image by doing
```julia
h = buddha(10^7) # "buddhabrot" of 10^7 points drawn from the uniform distribution
h₁ = buddha(𝓅, 10^7) # "buddhabrot" of 10^7 points drawn from distribution 𝓅
```
When generating the "buddhabrot" a histogram is made of mandelbrot trajectories from some
number `z`. By default these numbers are drawn from a uniform distribution, but they can
be drawn from any other 2-dimensional distribution using the
[Distributions.jl](https://github.com/JuliaStats/Distributions.jl) package.
Note that the generation of trajectories will take place on parallel threads, but the
histogram is generated sequentially.
## Histogram
The "buddhabrot" is a simple histogram, and for this I created a simple `histogram`
function using a simple binary search. Both of these functions can be found in
`src/utils.jl`. The binary search seems to have fairly good performance, but I did not go
crazy optimizing it.
## Images



