# Julia sets in Julia, using Interact.jl - I'd like to get it faster

**URL:** https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533
**Category:** Performance
**Created:** [March 4, 2020, 7:48pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533 "2020-03-04T19:48:27Z")
**Posts on this page:** 10
**Page:** 2

<div class="post-metadata">

### Author: ![zenon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zenon/32/6508_2.png) [@zenon](https://discourse.julialang.org/u/zenon)
#### Post date: [March 9, 2020, 10:21am UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/21 "2020-03-09T10:21:31Z")

</div>

Moritz, do you know the concrete parameters used for that picture?  
And is the color choosen algorithmically?

Greetings, z.

---

<div class="post-metadata">

### Author: ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)
#### Post date: [March 9, 2020, 10:50am UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/22 "2020-03-09T10:50:45Z")

</div>

I think the code is lost, but I remember that I just made a black on white picture and coloured the areas in Gimp. I believe I started searching at c= -0.5 + 0.75im and looked for something resembling 3 circles and perhaps used a large maxiter to “fill the circles”.

---

<div class="post-metadata">

### Author: ![eaubanel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eaubanel/32/13327_2.png) [@eaubanel](https://discourse.julialang.org/u/eaubanel)
#### Post date: [March 9, 2020, 12:17pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/23 "2020-03-09T12:17:56Z")

</div>

The number of iterations is not the same for each point on the grid. Therefore a static partitioning (such as that done by `@threads`) may produce sub-optimal speedup because of load imbalance. Perhaps a dynamic partitioning using `Threads.@spawn`?

---

<div class="post-metadata">

### Author: ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)
#### Post date: [March 12, 2020, 5:40am UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/24 "2020-03-12T05:40:21Z")

</div>

Beautiful!

You can get a similar but more fine grained coloration by iterating the three inverse mappings as an IFS and tracking which mappings were applied in the color. Here’s an attempt (though I didn’t find something quite similar to your `c` parameter):

 ![](https://global.discourse-cdn.com/julialang/original/3X/d/8/d82090a477fe2f5f92d6e14b4bb3fb3bf9052efc.png)

Hacky non-optimized code at [Julia Fractals via inverse iteration · GitHub](https://gist.github.com/c42f/9810a91fdf439fe0e532639ed96abc56)

---

<div class="post-metadata">

### Author: ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)
#### Post date: [March 12, 2020, 2:01pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/25 "2020-03-12T14:01:58Z")

</div>

Ok, I found the region with your program: around c = -0.5368 + 0.0923im

 ![julia](https://global.discourse-cdn.com/julialang/original/3X/2/2/2272a587c7c98705b4cc0140b02da5da865f4c49.png)

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [March 12, 2020, 6:40pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/26 "2020-03-12T18:40:50Z")

</div>

I loved your idea of changing the hue around a circle to get the Julia colors. I couldn’t find a way to make the journey from purple (bottom right) to red (bottom left) to green (top) though. I think purple and red are too close here:

 ![juliaset](https://global.discourse-cdn.com/julialang/original/3X/c/b/cb86ac03179d1ab9daef6c74b9aa8904f6b458e4.png)

---

<div class="post-metadata">

### Author: ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)
#### Post date: [March 13, 2020, 4:11am UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/27 "2020-03-13T04:11:00Z")

</div>

For those parameters it seems my program has trouble sampling the attractor at all points — even with the tree traversal and pruning technique I’m using, the center is sparse. OTOH, @cormullion’s image from the escape time algorithm (I assume!) clearly shows the attractor is non empty in that region.

Maybe it would help to adapt the choice of maps to the local contractivity of the mappings (or some such thing) to schedule the exploration of the attractor in a more sensible way. My thought is that some trajectories are dying too early due to passing through very contractive parts of the space.

---

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [April 12, 2020, 3:38pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/28 "2020-04-12T15:38:34Z")

</div>

When I created [Fatou.jl](https://github.com/chakravala/Fatou.jl) it was highly optimized for performance by using parametric types to fully precompile every aspect of the code.

---

<div class="post-metadata">

### Author: ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)
#### Post date: [May 6, 2020, 4:59pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/29 "2020-05-06T16:59:41Z")

</div>

Post scriptum: the z^3 Mandelbrot set:

 ![mandelbrot3](https://global.discourse-cdn.com/julialang/original/3X/f/f/ffa5b0d54051029490c70dc845bd76312a0b1d34.png)

asdfdajshfads;jkf adsklj fadsklfj

---

<div class="post-metadata">

### Author: ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)
#### Post date: [July 28, 2021, 8:00pm UTC](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533/30 "2021-07-28T20:00:47Z")

</div>

Flattered to see that a variant of the Julia set with power z³ in place of z² features in the #juliacon video intros! @cormullion

[Previous page](https://discourse.julialang.org/t/julia-sets-in-julia-using-interact-jl-id-like-to-get-it-faster/35533.md?page=1)
