![]() |
[QUOTE=ewmayer;193693]I don`t like decimal-fetishism myself, so allow me to propose the following 2 possible efficiency metrics for rational approximations p/q:[/QUOTE]
Why not just compare log pq to -log (|p/q - pi|/pi)? That gets rid of the discreteness issues. |
[QUOTE=CRGreathouse;193699]Why not just compare log pq to -log (|p/q - pi|/pi)? That gets rid of the discreteness issues.[/QUOTE]
The boldfaced formula I give above does just that - the first 2 were more or less "thinking aloud". |
[quote=ewmayer;193693][I]
[B]Efficiency E(x;p,q) = log(x/|x - p/q|) / (log(p) + log(q)).[/B] [/I] E(22,7) = 1.55... 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?[/quote] 3=3/1 is better : efficiency(3,1) = 2.82... ;-) |
[QUOTE=m_f_h;193702]3=3/1 is better :
efficiency(3,1) = 2.82... ;-)[/QUOTE] True indeed, although one could argue this is due more to large granularity when #digits is small than anything else. If you do similarly with [i]e[/i] replacing pi you get roughly half the efficiency(3,1). But in a way it make perfect sense ... you can get within a few %accuracy for pi using just one digit, which is very efficient. If you want more accuracy, you have to sacrifice some efficiency. Perhaps the relevant question is "for a given desired level of accuracy, what is the most efficient approximation?" In that context, of one can gain accuracy with little or no sacrifice in efficiency it's a win. |
I was thinking (while traveling) of the p function that is used in chemistry.
p[x]=-log[sub]10[/sub](x) I would measure the efficiency as (subing r for p for clarity): E[x;r,q] = p[|x - r/q|] / (int(log[sub]10[/sub](r) + int(log[sub]10[/sub](q))) or E[x;r,q] = p[|x - r/q|] - (int(log[sub]10[/sub](r) + int(log[sub]10[/sub](q))) For decimal numbers this rewards accuracy, but doesn't punish numbers like 101 v. 999. I don't have time to run the formulas to show how well they work on 4, 3, 22/7, and 355/113. |
Here is one interesting observation:
Take the continued fraction expansion of log 2, log 3, etc. for base = 10. wims.unice.fr is well equipped with excellent online calculators, plotters, interactive exercises, and then mathematical recreation tools. CFRAC calculator is available at wims.unice.fr website. [B][SIZE=4]log 2[/SIZE][/B] [SIZE=+1]1/[URL="http://wims.unice.fr/wims/wims.cgi#"]3[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]3[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]9[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]4[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]6[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]2...[/URL] [SIZE=2]The convergents are given by 1/3, 3/10, 28/93, 59/196, 146/485, 643/2136... 2[sup]Denominator[/sup] is close to [/SIZE][/SIZE][SIZE=+1][SIZE=2]10[/SIZE][/SIZE][sup][SIZE=+1][SIZE=2]Numerator[/SIZE][/SIZE][/sup] [SIZE=+1][SIZE=2] That is, 8, 1024, 9903520314283042199192993792, etc. are all close to power of 10.[/SIZE] Take [B]log 3[/B]. [/SIZE][SIZE=+1]1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]10[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]13[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]7[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=GQCC8FD4BA.7&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=%28log%283%29%29%2F%28log%2810%29%29&precision=20&num_style=1#"]18...[/URL] [SIZE=2]Convergents = 1/2, 10/21, 21/44, 52/109, 73/153, 1001/2098, 1074/2251, 8519/17855... 3[/SIZE][/SIZE][sup][SIZE=+1][SIZE=2]Denominator[/SIZE][/SIZE][/sup][SIZE=+1][SIZE=2] will be = 9 10460353203 984770902183611232881 9989689095948428268966921126195809393034773710522520293009978943147202723[/SIZE] Ok. Now for any general number say [tex]\pi[/tex] or e. Will you have to examine for [/SIZE][SIZE=+1][tex]10^\pi[/tex][/SIZE][SIZE=+1] or [tex]10^e[/tex], for its powers, to be close to a power of 10, having the (numerator + 1) number of digits? Starting up with 1, and keeping on multiplying by [/SIZE][tex]10^\pi[/tex][SIZE=+1] in a calculator or taping off its exponent (keeping every value less than 10, by using [/SIZE][tex]10 ^ {Frac (k\ log\ 10^\pi)}[/tex][SIZE=+1], for the k[/SIZE][sup][SIZE=+1]th[/SIZE][/sup][SIZE=+1] power of [/SIZE][tex]10^\pi[/tex][SIZE=+1]), is an interesting task to do so. [tex]\pi[/tex] = [/SIZE]3 + [SIZE=+1] 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]7[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]15[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]292[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]3[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]14...[/URL] But, e follows up with a regular pattern, in its continued fraction expansion itself only... [/SIZE]2 + [SIZE=+1] 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]4[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]6[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]8[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]10...[/URL] You can even try out with [/SIZE][tex]10^\phi[/tex][SIZE=+1] where [/SIZE][SIZE=+1][tex]\phi[/tex][/SIZE][SIZE=+1] is the golden ratio = [tex] \frac{1+\sqrt 5}{2} [/tex], which has no possible rational approximation at all, since [/SIZE][SIZE=+1][tex]\phi[/tex] = [/SIZE]1 + [SIZE=+1] 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi#"]1[/URL]... But [/SIZE][SIZE=+1][tex]\phi^n[/tex][/SIZE] [SIZE=+1]for sufficiently large n is approximately equal to the n[/SIZE][sup][SIZE=+1]th[/SIZE][/sup][SIZE=+1] Lucas Number, and then n[/SIZE][sup][SIZE=+1]th[/SIZE][/sup][SIZE=+1] Fibonacci Number is approximately equal to the [/SIZE][tex]\frac{n^{th}\ Lucas\ Number}{\sqrt 5}[/tex] |
e
For [I]e[/I], the efficient fraction just may be based on the fact that there's Leo Tolstoy year of birth, twice, then the angles of the right isosceles triangle (45,90,45), but we are not going to use the last part, so
(27+1828/9999)/10 = [SIZE=3][B]271801/99990[/B][/SIZE] ? Does CF sequence contain it? |
Efficient Integer Representations of Irrationals
[FONT=Calibri]... An efficient integer representation of an irrational number is defined as two integers p/q which, when expressed as a decimal, gives at least as many significant digits as the sum of the digits in p and in q. ...[/FONT]
[FONT=Calibri]Finding an efficient representation for e is a little more challenging. While 2721/1001 (= 2.71828172) is accurate to more than one part in 9 million, it does not quite qualify as efficient, and, while 193/71 (= 2.71831) is borderline efficient, it is only accurate to about one part in 36,000.[/FONT] [FONT=Calibri]JB[/FONT] |
[quote=Batalov;193933]For [I]e[/I], the efficient fraction just may be based on the fact that there's Leo Tolstoy year of birth, twice, then the angles of the right isosceles triangle (45,90,45), but we are not going to use the last part, so
(27+1828/9999)/10 = [SIZE=3][B]271801/99990[/B][/SIZE] ? Does CF sequence contain it?[/quote] Not quite. CF(e)___________=2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,... CF(271801/99990)=2,1,2,1,1,4,1,1,6,1,1,8,1,1,5. |
[QUOTE=Uncwilly;193719]E[x;r,q] = p[|x - r/q|] / (int(log[sub]10[/sub](r) + int(log[sub]10[/sub](q)))[/QUOTE]I tweaked the formula such that the length of r and q work correctly.
So for a few chosen approximations (of pi) we have (the greater + the better) [code]r q E 4 [COLOR="blue"]-0.93[/COLOR] 3 [COLOR="red"]-0.15[/COLOR] 22 7 [COLOR="red"]-0.10[/COLOR] 333 106 -1.92 355 113 [COLOR="Green"]0.57[/COLOR] 312689 99532 [COLOR="Blue"]-0.46[/COLOR][/code] |
[quote=mart_r;193998]Not quite.
CF(e)___________=2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,... CF(271801/99990)=2,1,2,1,1,4,1,1,6,1,1,8,1,1,5.[/quote] Indeed, not the best fraction. It is simply [I]'worse'[/I] than trimming before the 10: 2,1,2,1,1,4,1,1,6,1,1,8,1,1 => 49171/18089 = 2.7182818287357... (with Tolstoy still happy) |
| All times are UTC. The time now is 14:05. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.