Just saw this quite interesting post on twitter. I would like to show one way to create this plot with several built-in functions and one WFR function:
ResourceFunction[“AccumulateApply”] is very handy in this case:
In[]:=
[◼]
AccumulateApply
[f,Range[4]]
Out[]=
{f[1],f[1,2],f[1,2,3],f[1,2,3,4]}
It takes the incremental length of arguments and this is what we need: the approximation of π using incremental depth of layers of continued fraction:
Put the data into the plot function and generate the log-log plot of denominator of nearest rational number vs. error of estimation. The lower bound is connected by continued fraction approximation. The label using the same convention in the twitter.