Site icon R-bloggers

Rcpp, Camarón de la Isla and the Beauty of Maths

[This article was first published on R – Fronkonstin, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Desde que te estoy queriendo
yo no sé lo que me pasa
cualquier vereda que tomo
siempre me lleva a tu casa
(Y mira que mira y mira, Camarón de la Isla)

The verses that head this post are taken from a song of Camarón de la Isla and illustrate very well what is a strange attractor in the real life. For non-Spanish speakers a translation is since I’m loving you, I don’t know what happens to me: any path I take, always ends at your house. If you don’t know who is Camarón de la Isla, hear his immense and immortal music.

I will not try to give here a formal definition of a strange attractor. Instead of doing it, I will try to describe them with my own words. A strange attractor can be defined with a system of equations (I don’t know if all strage attractors can be defined like this). These equations determine the trajectory of some initial point along a number of steps. The location of the point at step i, depends on the location of it at step i-1 so the trajectory is calculated sequentially. These are the equations that define the attractor of this experiment:

As you can see there are two equations, describing the location of each coordinate of the point (therefore it is located in a two dimensional space). These equations are impossible to resolve. In other words, you cannot know where will be the point after some iterations directly from its initial location. The adjective attractor comes from the fact of the trajectory of the point tends to be the same independently of its initial location.

Here you have more examples: folds, waterfalls, sand, smoke … images are really appealing:

The code of this experiment is here. You will find there a definition of parameters that produce a nice example image. Some comments:

This post is inspired in this beautiful book from Julien Clinton Sprott. I would love to see your images.

To leave a comment for the author, please follow the link and comment on their blog: R – Fronkonstin.

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.