![]() |
|
|
#1 |
|
Oct 2009
5 Posts |
What are the most efficient integer representations of the irrational numbers Pi and e?
An efficient integer representation of an irrational number is defined as two integers p/q such that their decimal representation gives at least as many significant digits as the sum of p + q. For example, 22/7 is an efficient integer representation of Pi since p/q (= 3.1428) returns a little better than 3 significant digits. Hint: (Pi – 22/7)-1 = -791. In other words 22/7 is good to better than one part in 791. (Pi - 22/7 + 791-1)-1 = ? |
|
|
|
|
|
#2 |
|
Dec 2008
you know...around...
3×13×17 Posts |
A good one is 355/113.
There's this number 20776 at position 432 in the continued fraction expansion of pi, if I would calculate the fraction of the 431 previous terms I would also get an efficient integer representation, or whenever such a large number in the continued fraction appears. The best known approximation is log(640320³+744)/sqrt(163) - it gives 31 significant digits! Edit: but I don't know of any really good approximations for e. Last fiddled with by mart_r on 2009-10-23 at 13:40 |
|
|
|
|
|
#3 |
|
Aug 2006
3×1,993 Posts |
An especially good rational representation in this sense is
Code:
1901870728566923076090143944714770339621590768313546337192526115562704339680963564320007808107929370299752345187688835741387003036853361285671158059867702399073227994426905220194699766118756059055619036488502928002591 ------------ 605384255146420326102361023215940531716391478150345020739231253172134740688232476946000058713774549796561447468267746412874022717544100946587144148739626803435133473281606663121381125761746030151344353855924025288111 |
|
|
|
|
|
#4 |
|
Tribal Bullet
Oct 2004
DD516 Posts |
One can produce a stream of these efficient representations by using the continued fraction esxpansion of pi or e. There is a huge body of analysis on this subject, including theorems that in order to get a better rational approximation than a truncated continued fraction, you must use a fraction with larger terms in the numerator and denominator.
Of course, to get a continued fraction expansion of a transcendental number you need to know its decimal expansion first, so it's not exactly like this is a free lunch. One of my favorites: 6^(0.25) is close to pi/2. Last fiddled with by jasonp on 2009-10-23 at 15:04 |
|
|
|
|
|
#5 | |
|
(loop (#_fork))
Feb 2006
Cambridge, England
72·131 Posts |
Quote:
http://www.inwap.com/pdp10/hbaker/hakmem/cf.html |
|
|
|
|
|
|
#6 | |
|
Nov 2003
164448 Posts |
Quote:
with the word 'approximation'. A representation of PI is EXACT. An approximation is not. There are many representations of PI that use only integers. (e.g. infinite series). There are many representations that use e.g. elementary transcendental functions such as 4*ATAN(1). There are infinitely many approximations as the ratio of two integers. Furthermore, the word "efficient" needs to be quantified. One way to do this is in terms of the height of the rational approximation. One can always find p1/q1 and p2/q2 so that both ratios are good approximations to PI. But the better the approximation, the larger p_i and q_i will be. So, if one uses an approximation using the ratio of integers near (say) 20 digits in size and compares it against a ratio using 10 digit integers, then one must ask: which is more "efficient". The former will be more accurate, but requires more digits. You need to tell US what you mean by "efficient". |
|
|
|
|
|
|
#7 | |
|
Jun 2003
5,051 Posts |
Quote:
|
|
|
|
|
|
|
#8 | |
|
Nov 2003
1D2416 Posts |
Quote:
Perhaps it merely needs to be reworded. Take 22/7. p=22, q=7. What does "their decimal representation" mean? I will assume that what is meant is that the RATIO 22/7 gives, in its decimal representation, an approximation [to PI] that is correct to the specified number of digits. Is this what is meant? Their decimal representation is 22 and 7 respectively. Their sum is 29. 22/7 does not yield an approximation to PI that is good to 22 + 7 = 29 digits. |
|
|
|
|
|
|
#9 |
|
Aug 2006
3·1,993 Posts |
I looked for rationals a/b such that the number of digits in a and the number of digits in b, subtracted from the number of correct decimals in a/b, was large. My solution has 'goodness' 3.378... which is the highest I found.
I used Code:
goodness(r)={precision(-log(abs(r-Pi)/Pi)/log(10)-digits(numerator(r))-digits(denominator(r)),9)};
best(n)={my(s);if(type(c)!="t_VEC"||#c<n,default(realprecision,n*3);c=contfrac(Pi));s=c[n];forstep(k=n-1,1,-1,s=c[k]+1/s);s};
list(lim,expected=1.3)={for(n=1,lim,g=goodness(best(n));if(g>expected,print(n"\t"g)))};
|
|
|
|
|
|
#10 | |
|
Nov 2003
22×5×373 Posts |
Quote:
Perhaps looking at pairs (p,q) such that | p/q - PI| < RHS := 10^-(canonical height of (p/q)) is what is desired? Or perhaps we want to search globally for the smallest such RHS? I'm not sure whether RHS is bounded away from 0 for transcendentals. It can't be too small for *algebraic irrationals* via Thue's Theorem. |
|
|
|
|
|
|
#11 | |
|
∂2ω=0
Sep 2002
República de California
103×113 Posts |
Quote:
I don`t like decimal-fetishism myself, so allow me to propose the following 2 possible efficiency metrics for rational approximations p/q: 1. Efficiency = (number of significant bits in the approximation p/q) / (sum of number of bits of p and q), where "number of bits" means sans any leading zeros, and the number of significant bits is based on the position of the first/leftmost non-matching bit of the irrational number being approximated by ; 2. Efficiency = (number of significant bits in the approximation p/q) - (sum of number of bits of p and q). ----------------- I'm not sure whether the ratio or the difference is more appropriate. But I don't like either of these, because simple bit-counting can be very misleading as an error metric: for example (using decimals) 3.1415 has more matching leading decimal digits with respect to pi = 3.14159265358979323... than does 3.1416, but the latter is more accurate in terms of actual error. So I prefer an efficiency metric along these lines (here x is the number being approximated by p/q): Take the logarithm of inverse relative error of the approximation to represent "number of digits of accuracy" in a base-independent way. Divide that by the sum of the same-base logs of p and q. The resulting definition of efficiency (where we assume x, p and q are all positive for the sake of simplicity - one can easily generalize this to handle arbitrary signs of x,p,q): Efficiency E(x;p,q) = log(x/|x - p/q|) / (log(p) + log(q)). In word form, this formula could be summed up roughly as "number of significant digits in the rational approximation divided by number of input digits required to achieve it". Let`s try it out - For the above approximations to pi, this gives the following values: E(22,7) = 1.55... E(23,7) = 0.60... (Sanity check #1: We expect that beginning with an efficient approximation and changing one of p or q while holding the other fixed should significantly reduce the efficiency of the result) E(44,14) = 1.21... (Sanity check #2: Using a nonreduced form of a given ratio decreases efficiency) E(355/113) = 1.53... (p and q roughly double the logarithm vs 22 and 7 and log of relative error is roughly halved, so E about the same as for 22/7) Code:
E(1901870728566923076090143944714770339621590768313546337192526115562704339680963564320007808107929370299752345187688835741387003036853361285671158059867702399073227994426905220194699766118756059055619036488502928002591,605384255146420326102361023215940531716391478150345020739231253172134740688232476946000058713774549796561447468267746412874022717544100946587144148739626803435133473281606663121381125761746030151344353855924025288111) = 1.01... So based on this metric, 22/7 is the efficiency champion for rational approximants to pi, with 355/113 running a close second. Can anyone beat 22/7? Last fiddled with by ewmayer on 2009-10-23 at 19:08 |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Efficient Test | paulunderwood | Computer Science & Computational Number Theory | 5 | 2017-06-09 14:02 |
| k*b^n+/-c where b is an integer greater than 2 and c is an integer from 1 to b-1 | jasong | Miscellaneous Math | 5 | 2016-04-24 03:40 |
| Totally Awesome Graphical Representations of Data | Uncwilly | Lounge | 5 | 2015-10-05 01:13 |
| Most efficient way to LL | hj47 | Software | 11 | 2009-01-29 00:45 |
| Fischbach Representations. | Mr. P-1 | Puzzles | 5 | 2007-10-10 16:16 |