๐Have Fun with Math & Statistics
Butterfly Curve

It was discovered by a mathematician in 1989, and later more mathematicians found the function's variants where leaves, flowers or other insects became apparent. Wondering why such studies had been done? ๐ Because mathematicians also need some entertainment, I guess! ๐

And guess what's more fun! If we just change butterfly curve function from cartesian coordinate system to polar coordinate system, look at the left chart, does it feel like golden butterfly storm!? โจ
Cartesian coordinate uses (x, y) coordinate system to specify points in a plane, while polar coordinate uses distance r and angle ฮธ to specify points. A general form of polar equation is r = f(ฮธ), which determines how does distance r depend on the angle ฮธ. Butterfly curve's polar equation looks as below:
In Python code, polar coordinate is considered as a type of projection called polar projection. We can also change to lambert projection to view butterfly curve from another perspective. Look at the plot on the right, isn't it beautiful?

Butterfly Dances
Now, let's use the magic of distributions to make butterflies gracefully dance before your eyes!

The shape of "beta dance" was using beta distribution, and the shape of "logistic dance" was using logistic distribution.
To make butterfly dances come true, let's understand the differences between pdf and cdf first. The cdf (cumulative distribution function) is the probability that random variable values less than or equal to x whereas the pdf (probability density function) is a probability that a random variable will take a value exactly equal to x. Often times, when we plot the distribution curve, we use pdf.
The butterfly dances are plotted with cdf. The curves below plots the pdf and cdf for beta distribution and logistic distribution. The left side smooth curves are pdfs with different parameter settings, and the right side blue stars form cdf curves with intervals.

With these intervalled cdf, you just need to replace the blue stars with butterflies. You can choose not to connect butterflies together, but Lady H. chose to link them together so that you can see the shape of the dances clearly.
๐ป Check all the code here >>
Umbrella White Rose

Sometimes Lady H. landed on a planet where cameras can't be used at all, in order to visually record the amazing scenes she saw, she applies math & distributions too!
This is a perfect example when Lady H. landed on a planet called "Rusthaven", where everything here is in rusty red and the sky kept dropping rusty rain. She walked around, trying to find a restaurant (in fact she's not hungary at all, just wanted to see what does the food look like there ๐), suddenly she noticed a white rose in full bloom on the ground, its vivid white hue stood out dramatically against the backdrop. Why this rose wasn't dyed into rusty red? Ahhh, there's a transparent "umbrella" above the rose! In fact, it's an umbrella formed by this rose itself! What an amazing nature.
To draw this scene, the method is similar to golden butterflies. You can draw a rose using rose curve, the rusty rain is formed by distribution curves (the pdf of gamma distributions), and the umbrella was formed by 2 linear lines.
๐ป Check all the code here >>
What's worth mentioning is, you might be seeing rose curve everyday when you're drinking coffee ๐, like this:

This is a special shape of rose curve called "cardioid". Besides, by changing the parameter settings, we can get different rose shapes, for example:

Last updated
