Flowers for Julia
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
No hables de futuro, es una ilusión cuando el Rock & Roll conquistó mi corazón (El Rompeolas, Loquillo y los Trogloditas)
In this post I create flowers inspired in the Julia Sets, a family of fractal sets obtained from complex numbers, after being iterated by a holomorphic function. Despite of the ugly previous definition, the mechanism to create them is quite simple:
- Take a grid of complex numbers between -2 and 2 (both, real and imaginary parts).
- Take a function of the form setting parameters and .
- Iterate the function over the complex numbers several times. In other words: apply the function on each complex. Apply it again on the output and repeat this process a number of times.
- Calculate the modulus of the resulting number.
- Represent the initial complex number in a scatter plot where x-axis correspond to the real part and y-axis to the imaginary one. Color the point depending on the modulus of the resulting number after applying the function iteratively.
This image corresponds to a grid of 9 million points and 7 iterations of the function :
To color the points, I pick a random palette from the top list of COLOURLovers site using the colourlovers
package. Since each flower involves a huge amount of calculations, I use Reduce to make this process efficiently. More examples:
There are two little Julias in the world whom I would like to dedicate this post. I wish them all the best of the world and I am sure they will discover the beauty of mathematics. These flowers are yours.
The code is available here.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.