Approximations with continued fractions

In an excellent blog post earlier this year, Dave Richeson commented on the approximation:

\sin(11)\approx -1.

The reason for this is the well-known approximation

\displaystyle{\pi\approx \frac{22}{7}}

from which

\sin(11)\approx \sin\left(\frac{7\pi}{2}\right)=-1.

And this approximation, and more, can be obtained from the continued fraction for \pi. This raises the question: can other interesting approximations be obtained from other continued fractions? Before we start, here’s the beginning of the continued fraction for \pi:

3+\cfrac{1}{7+\cfrac{1}{15+\cfrac{1}{1+\cfrac{1}{292}}}}

Since 292 is a fairly large number, we would expect a good approximation if we chopped the continued fraction at this point:

\displaystyle{3+\cfrac{1}{7+\cfrac{1}{15+\cfrac{1}{1}}}=\frac{355}{113}}.

We can do this easily in Sage:

sage: F=continued_fraction(pi)
sage: F
  [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3]
sage: i=list(F).index(max(F))
sage: convergent(F,i-1)
  355/113

So here’s a recipe for finding interesting approximations: find a continued fraction containing a large integer, and take the convergent up to that value.

Here are some examples, first a “near integer” e^{1535/483}\approx 24:

sage: F=continued_fraction(log(24))
sage: F
  [3, 5, 1, 1, 1, 1, 1, 1, 6, 35660, 1, 3]
sage: i=list(F).index(max(F))
sage: convergent(F,i-1)
  1535/48
sage: exp(1535/483).n()
  23.9999999971151

Next, an approximation to \pi (this one is actually quite well known) \pi\approx (2143/22)^{1/4}:

sage: F=continued_fraction(pi^4)
sage: F
  [97, 2, 2, 3, 1, 16539, 1, 6, 3]
sage: i=list(F).index(max(F))
sage: convergent(F,i-1)
  2143/22
sage: (2143/22)^(1/4).n()
  3.14159265258265

And an approximation to the Euler-Mascheroni constant \gamma\approx (721/949)^2:

sage: F=continued_fraction(sqrt(euler_gamma))
sage: F
  [0, 1, 3, 6, 6, 5, 1, 301, 2, 24, 3, 1]
sage: i=list(F).index(max(F))
sage: x=convergent(F,i-1);x
  721/949
sage: x^2.n()
  0.577215659320831
sage: euler_gamma().n()
  0.577215664901533

To read more about continued fractions, the Wikipedia page is a good start, and there’s lots of detail here (including some discussion about approximations). For those of you with access to a good library, William Stein’s superb book “Elementary Number Theory: Primes, Congruences, and Secrets” has a chapter on continued fractions.

About these ads

2 comments

  1. Chris Johansen

    Marvellous blog!

    A tiny slip of the finger at “chopped the continued fraction at this point: . . . 335/113″

    Sage got it right (of course):

    sage: convergent(F,i-1)
    355/113

    I noticed only because 11 3|3 55 (| means “divides”) is a well-known and easily remembered approximation for small, four-function calculators. It was especially useful eons ago, at the dawn of the calculator age (think Bomar), when four-function meant just and only four functions with eight or fewer significant digits.

    Off-topic aside: I enjoy your music for the end of the week.

    Thanks.

  2. amca01

    Thanks for that – I’ve now changed it.

    And thanks for your kind words, too!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: