Find Optimal Int Ratios to Approximate Pi

  • Context: High School 
  • Thread starter Thread starter Astronuc
  • Start date Start date
  • Tags Tags
    Pi
Click For Summary

Discussion Overview

The discussion revolves around finding optimal integer ratios to approximate the mathematical constant pi (π). Participants explore various integer fractions, their relative errors, and the potential for algorithms to identify the best approximations based on desired accuracy. The scope includes mathematical reasoning and exploration of approximation techniques.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • V50 introduces the idea of integer ratios approximating pi, noting that 355/113 is a well-known approximation with a small error.
  • Some participants suggest that the best quotient should balance minimal error and the shortest length, proposing a need for a single-valued function to optimize these criteria.
  • There is mention of various approximations, including 22/7 and 312689/99532, with discussions on their respective errors and efficiency.
  • One participant asserts that adding a digit to the numerator generally improves the approximation significantly, citing specific examples of approximations and their errors.
  • Another participant questions the practicality of fraction approximations, suggesting that memorizing digits of pi may be more efficient than using certain fractions.
  • There is a suggestion to explore the concept of continued fractions for potentially better approximations.

Areas of Agreement / Disagreement

Participants express differing views on the effectiveness of various integer approximations for pi, with no consensus on a single best approximation or method. The discussion remains unresolved regarding the optimal approach to finding integer ratios.

Contextual Notes

Participants highlight limitations in their discussions, such as the dependence on the definitions of "best" and "efficient," as well as the unresolved nature of how to quantify the quality of approximations.

Astronuc
Staff Emeritus
Science Advisor
Gold Member
2025 Award
Messages
22,514
Reaction score
7,452
TL;DR
Integer ratio(s) approximating pi
On July 22, V50 wrote https://www.physicsforums.com/threads/happy-pi-day.985513/post-6518554,

and it got me thinking about the ratio of two integers approximating pi. I presume someone has done it, and that there is an algorithm for an optimal calculation.

Then I found - https://en.wikipedia.org/wiki/Approximations_of_π#Practical_approximations
Depending on the purpose of a calculation, π can be approximated by using fractions for ease of calculation. The most notable such approximations are 22⁄7 (relative error of about 4·10−4) and 355⁄113 (relative error of about 8·10−8).
When reading V50's post, I thought of 7/22 rather than 22/7.

7/22 = 0.3181818... but that's ~pi/10, but one can multiply by 10 and get 70/22, 3.181818... I didn't immediately realize that ratio is 35/11, which would have lead me to 355/113, which by the way gives me an error to pi of 2.6676418940E-07 (using Excel on a Mac). Nevertheless, 355/113 gives an efficient approximation with a very small error that 22/7

Anyway, I soon realized that I had started with 7/22 and not 22/7, the latter being the classic approximation with the smallest integers.

So, I started expanding the numerator and denominator.

22/7 = 220/70 = 3.142857

2200/701 = 3.13837375 (in wrong direction)

2203/701 = 3.14265335 overshoot

2202/701 = 3.14122682 undershoot
----------------------------------
a different path

22000 / 7001 = 3.142408 overshoot but less than 2203/701

22000 / 7002 = 3.141959 better

22000 / 7003 = 3.141511 better, but undershoot

22001 / 7003 = 3.141654

220010 / 70035 = 3.141429 scaling up

220010 / 70034 = 3.141474 moving in the right direction

220010 / 70033 = 3.14151900

220010 / 77032 = 3.141564 (pi = 3.14159265358979...)

Adjusting the numerator
220012 / 77032 = 3.1415924

2200121 / 700320 = 3.1415938

2200121 / 700321 = 3.1415894

22001212 / 7003200 = 3.1415941 (I didn't think to divided by 2, which would give me 11000606/3501600,
or by 4 giving 5500303 / 1750800

22001212 / 7003201 = 3.1415937

22001212 / 7003202 = 3.1415932

22001212 / 7003203 = 3.14159278

I started using Excel rather than my calculator
220012121 / 70032040 = 3.141592348302290

220012121 / 70032040 = 3.14159234830229 err -3.0528750194E-07

220012143 / 70032040 = 3.14159266244422 err 8.8544251931E-09

220012121 / 70032033 = 3.14159266231783 err 8.7280351835E-09

220012127 / 70032035 = 3.14159265827417 err 4.6843808832E-09

I tried a few more steps

2200121267 / 700320350 = 3.14159265399042 err 4.0062708706E-10

2200121270 / 700320351 = 3.14159265378824 err 1.9844437205E-10

2200121430 / 700320402 = 3.14159265347235 err -1.1744738515E-10
1100060715 / 350160201 divide by 2
366686905 / 116720067 divide previous line by 3, or the line before by 6. I realized this while creating this post. There were other opportunities to realize this earlier.

So I was wondering if there is a program or algorithm that has been developed to identify the best set of integers based on the desired error.

Or is 355⁄113 the best (most efficient, with a reasonably small error) and we're done.
 
Last edited:
Mathematics news on Phys.org
The best quotient is the one that takes the most digits. The shortest possible is ##3##. So we have two conflicting targets: minimal error and shortest length. To answer the question, we would need a combination of them to a single-valued function which we then can optimize. As long as we have both, I see no way to get to a result.

With respect to the many formulas to calculate ##\pi,## it might be more reasonable to ask for the fastest algorithm to achieve a given error margin or to ask for the shortest formula to describe an algorithm.
 
  • Like
Likes   Reactions: Janosh89, DaveE and FactChecker
Astronuc said:
Summary:: Integer ratio(s) approximating pi

On July 22, V50 wrote https://www.physicsforums.com/threads/happy-pi-day.985513/post-6518554,

and it got me thinking about the ratio of two integers approximating pi. I presume someone has done it, and that there is an algorithm for an optimal calculation.

Then I found - https://en.wikipedia.org/wiki/Approximations_of_π#Practical_approximations

When reading V50's post, I thought of 7/22 rather than 22/7.

7/22 = 0.3181818... but that's ~pi/10, but one can multiply by 10 and get 70/22, 3.181818... I didn't immediately realize that ratio is 35/11, which would have lead me to 355/113, which by the way gives me an error to pi of 2.6676418940E-07 (using Excel on a Mac). Nevertheless, 355/113 gives an efficient approximation with a very small error that 22/7

Anyway, I soon realized that I had started with 7/22 and not 22/7, the latter being the classic approximation with the smallest integers.

So, I started expanding the numerator and denominator.

22/7 = 220/70 = 3.142857

2200/701 = 3.13837375 (in wrong direction)

2203/701 = 3.14265335 overshoot

2202/701 = 3.14122682 undershoot
----------------------------------
a different path

22000 / 7001 = 3.142408 overshoot but less than 2203/701

22000 / 7002 = 3.141959 better

22000 / 7003 = 3.141511 better, but undershoot

22001 / 7003 = 3.141654

220010 / 70035 = 3.141429 scaling up

220010 / 70034 = 3.141474 moving in the right direction

220010 / 70033 = 3.14151900

220010 / 77032 = 3.141564 (pi = 3.14159265358979...)

Adjusting the numerator
220012 / 77032 = 3.1415924

2200121 / 700320 = 3.1415938

2200121 / 700321 = 3.1415894

22001212 / 7003200 = 3.1415941 (I didn't think to divided by 2, which would give me 11000606/3501600,
or by 4 giving 5500303 / 1750800

22001212 / 7003201 = 3.1415937

22001212 / 7003202 = 3.1415932

22001212 / 7003203 = 3.14159278

I started using Excel rather than my calculator
220012121 / 70032040 = 3.141592348302290

220012121 / 70032040 = 3.14159234830229 err -3.0528750194E-07

220012143 / 70032040 = 3.14159266244422 err 8.8544251931E-09

220012121 / 70032033 = 3.14159266231783 err 8.7280351835E-09

220012127 / 70032035 = 3.14159265827417 err 4.6843808832E-09

I tried a few more steps

2200121267 / 700320350 = 3.14159265399042 err 4.0062708706E-10

2200121270 / 700320351 = 3.14159265378824 err 1.9844437205E-10

2200121430 / 700320402 = 3.14159265347235 err -1.1744738515E-10
1100060715 / 350160201 divide by 2
366686905 / 116720067 divide previous line by 3, or the line before by 6. I realized this while creating this post. There were other opportunities to realize this earlier.

So I was wondering if there is a program or algorithm that has been developed to identify the best set of integers based on the desired error.

Or is 355⁄113 the best (most efficient, with a reasonably small error) and we're done.
Another good approximation is 312689/99532, which has an error of 3E-11, and you can continue indefinitely. Also, 3.1415926536 has even a smaller error...
You may want to look at the concept of continued fractions.
 
IMO, the fraction approximation only has a benefit when it requires remembering fewer digits than simply memorizing the digits of pi to an equal accuracy. Very few meet that criteria. Even the benefit of 22/7 is debatable, since who does not already know 3.14?
 
  • Like
Likes   Reactions: Janosh89, DaveE and Vanadium 50
A few points:

One is that @Astronuc has introduced the idea of a quality of approximation. I assert without proof that I would expect that on average adding a digit to the numerator improves the approximation by a factor of 10. 22/7 is off by a part in 2500, so I would expect a three digit denominator to be good to a part in 25,000. However, 355/113 is good to a part in 11 million - about 400 times better than expected.

It's a very good approximation indeed. To get a better approximation, you need to go to a 5-digit denominator: 103993/33102, although the best 5 digit approximation is 312689/99532.

Computers are so fast these days that if you want to know what the best approximation is with 6 digits in the denominator, one can brute-force test all million numbers. At this point, approximations lose their utility. Is it easier to memorize 4272943/1360120 than pi itself to 11 or 12 digits?

So, as far as useful approximations go, I think the case can be made for just two: 22/7 and 355/113.

PS My calculator tells me 4272943/1360120 is exactly equal to pi.
 
  • Like
Likes   Reactions: Astronuc
Continued fractions give the "best" approximation in some sense - there won't be a better fraction (closer to pi) with a smaller denominator. The larger the next integer in the denominator of the continued fraction the better the approximation relative to the size of the denominator.

From Wikipedia:$$\pi=3+\textstyle \cfrac{1}{7+\textstyle \cfrac{1}{15+\textstyle \cfrac{1}{1+\textstyle \cfrac{1}{292+\textstyle \cfrac{1}{1+\textstyle \cfrac{1}{1+\textstyle \cfrac{1}{1+\ddots}}}}}}}$$

3+1/7 = 22/7, the next term is 333/106, and the following one is 355/113. The very large 292 that would enter the following term tells us that 355/113 is an unusually good approximation (and the next two will be quite poor again relative to their size).
 
  • Informative
  • Like
Likes   Reactions: FactChecker, berkeman, Astronuc and 1 other person
mfb said:
3+1/7 = 22/7, the next term is 333/106, and the following one is 355/113. The very large 292 that would enter the following term tells us that 355/113 is an unusually good approximation (and the next two will be quite poor again relative to their size).
Yeah, I overlooked that section :rolleyes:
https://en.wikipedia.org/wiki/Pi#Approximate_value_and_digits
Fractions: Approximate fractions include (in order of increasing accuracy) 22/7, 333/106, 355/113, 52163/16604, 103993/33102, 104348/33215, and 245850922/78256779.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K