2
$\begingroup$

A continued fraction can be seen as a way to approximate numbers with increasingly involved fractions. For example for $\pi$ it is $$\pi=3+\frac{1}{7+\frac{1}{15+\frac{1}{1+\dots}}}$$ Define $\pi_n$ as the number you get by only including $n$ terms in this continued fraction. I plotted the absolute error $|\pi_n-\pi|$ here below:

enter image description here

My question is about the jump at 292. 292 is a large number so I would expect that adding this term wouldn't increase precision by much. My reasoning is as follows. Consider the innermost nested fraction that still includes 292: $$\frac{1}{1+\frac{1}{292}}$$ Now, if I remove 292, I will essentially remove $1/292$. Like this: $$\frac{1}{1+0}$$

I removed a small number since 292 is a large number. Therefore, I would expect a small jump when going from $n=4$ to $n=5$. But instead I see a large jump so obviously my reasoning is not correct. What would be the correct reasoning?


The Mathematica code I used to create the plot:
piN[n_] := FromContinuedFraction[ContinuedFraction[\[Pi], n]]
error = Table[
   Labeled[{n, Abs[piN[n] - \[Pi]] // N}, 
    ContinuedFraction[\[Pi], n][[-1]]], {n, 1, 10}];
ListLogPlot[error, PlotRange -> Full, 
 AxesLabel -> {n, "Absolute Error"}, 
 PlotLabel -> "|\!\(\*SubscriptBox[\(\[Pi]\), \(n\)]\)-\[Pi]|"]
$\endgroup$
3
  • 1
    $\begingroup$ The the $292$ dominates the coming terms. $292+1/\cdots$ is much closer to $292$ than $1+1/\dots,$ in relative size. Have you studied how to compute the terms of a continued fraction? $\endgroup$ Apr 5, 2023 at 21:42
  • $\begingroup$ @ThomasAndrews What you wrote totally makes sense, but I don't think it answers my question. I think it explains why there is only a little gap after $n=5$, but not why there is a large gap between $n=4,5$. And yes, I do know how to compute these terms. $\endgroup$ Apr 5, 2023 at 21:47
  • 1
    $\begingroup$ I like Khinchin's little book for this sort of thing. archive.org/details/khinchin-continued-fractions $\endgroup$
    – Will Jagy
    Apr 5, 2023 at 21:49

2 Answers 2

2
$\begingroup$

You are correct that $1+\frac1{292}$ is a small difference, but is much close to its goal than $1+\frac12$ is to $1.414.$

Let's use this specific case. We are trying to approximate $\alpha_n=1.003417231013373.$ Already, we are close, but the difference between $\frac1n$ and $\frac1{n-1}$ is $\frac1{n(n-1)},$ so, when the next term is a large coefficient, we are getting significantly closer than when we get a coefficient of $1,$ which can be up to $1/2$ off the mark.

Indeed, $\left|\frac1{292} -\alpha_n\right|<\frac1{100000}.$ $1+\frac1{292}$ is $460$ times closer to $\alpha_n$ than $1$ is.

It is possible for a coefficient of $1$ to be a great coefficient, if for example, $\alpha=1.9999992.$ But even then, the next coefficient with be very large and get is much closer.

But on average, a coefficient of $c$ is off by $\frac1{2c(c+1)}.$

If $0<\alpha<1,$ and $\frac1c>\alpha>\frac{1}{c+1},$ then $\frac1c-\alpha<\frac1{c(c+1)}\approx\alpha^2.$ So yes, you integer component was only off by a small $\alpha$ initially, but you square that small number to get the new error - in layman terms, you double the number of significant digits of accuracy.

$\endgroup$
1
$\begingroup$

I think that redrawing your plot by signed error rather than absolute error will give a better intuition of how the sequence converges.

Simple continued fraction terms, evaluated in order, alternate between 'too large' and 'too small' in relation to the value of the whole fraction. Your redrawn plot will have a zig-zag pattern around the value pi. Consecutive terms represent the upper and lower bounds of a region within which the final value lies.

The distance between each pair of terms is the inverse of the product of the denominators of those terms. Therefore, a large denominator will greatly shrink the 'window' around the ultimate value. It will be a tiny step in the journey towards the final value. But crucially it will change the sign of the error from the previous (already small) error.

It can help to think about the continued fraction as a journey down the Stern-Brocot tree or Ford circles - I found this very useful. https://www.youtube.com/watch?v=hoB_Pjhinpk .

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .