Heads up! Approximation days are approaching.
A while ago, four months, the Americans celebrated the pi day, March 14, or 3/14, 3.14. Back then I posted about the pi approximation day instead (on our facebook pages) and soon it’s time to acknowledge that day. Just because I can I fire up octave and make a quick-and-dirty script to calculate the day-over-month ratios (like we normal people do in Europe …).
So, the first of January, is
1/1 = 1, second of January is
2/1 = 2, third of January is
3/1 = 3, etc. Then I guess you can figure out the pattern. Notice that this is not a one-to-one mapping, the second of January, for example, gives the same result as fourth of February.
Why is this important? Well, it is not actually, but – as mentioned – just because we can…
If we plot the results, we get the decreasing saw-tooth-like figure below
Let’s include the two most important numbers in our lives in the same plot! The pi is indicated with the black line and the e is a red line. I also took the liberty to zoom in for you to make the picture a bit more accessible.
What can we conclude from these pictures? Well, not that much. I find it kind of sad that we do not really find a good pi approximation day in the last three months of the year (possibly October, I admit). And look at poor December! It cannot approximate e nor pi very well… th th th. Luckily we have Christmas to cheer us up.
Anyway, let us come to the point of this post and why it is posted these days… Let us first construct some least-square measures, i.e.
(day_month_ratio - pi).^2
(day_month_ratio - exp(1)).^2
or something like that and then construct a relative error and express it in per cent and plot it again. This leads us to the results in the figure below. Red is now the error for the pi and black is for the e. (Sorry for swapping…)
I know that you are eager to see the results now… let’s use the zoom tool and just display the days that give good approximations, say 5%. See below! Remember black being e and red being pi now. From the graph, we can quite clearly see the months too, there are 12 dips. Counting from left we find lowest values in the seventh dip.
Isn’t this amazing? Both pi and e are best approximated in July! In fact, pi is approximated to 0.04 % of relative error and e to 0.15 %.
What days are these then? Perhaps to no surprise, the pi-approximation day is the 22nd of July , i.e.,
22/7 = 3.142857... which is a good old friend. The e is best approximated on the 19th of July, i.e.,
19/7 = 2.7142857....
Book your calendars and celebrate vacation these two days! And it is only three days between them!