mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Puzzles (https://www.mersenneforum.org/forumdisplay.php?f=18)
-   -   Efficient Integer Representations of Irrationals (https://www.mersenneforum.org/showthread.php?t=12601)

JonBarleycorn 2009-10-23 13:21

Efficient Integer Representations of Irrationals
 
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 = ?

mart_r 2009-10-23 13:33

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.

CRGreathouse 2009-10-23 14:22

An especially good rational representation in this sense is

[code]1901870728566923076090143944714770339621590768313546337192526115562704339680963564320007808107929370299752345187688835741387003036853361285671158059867702399073227994426905220194699766118756059055619036488502928002591
------------
605384255146420326102361023215940531716391478150345020739231253172134740688232476946000058713774549796561447468267746412874022717544100946587144148739626803435133473281606663121381125761746030151344353855924025288111[/code]

which represents pi to 3+ more decimal places than the sum of the digits in the numerator and denominator.

jasonp 2009-10-23 15:00

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 [i]must[/i] 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.

fivemack 2009-10-23 15:39

[quote]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.[/quote]

That turns out, strangely, not to be the case: if your transcendental number can be written in terms of hypergeometric functions, there are algorithms that get the continued fraction terms directly:

[url]http://www.inwap.com/pdp10/hbaker/hakmem/cf.html[/url]

R.D. Silverman 2009-10-23 15:52

[QUOTE=JonBarleycorn;193665]

For example, 22/7 is an efficient integer representation of Pi ?[/QUOTE]

No, it is not. You are confusing the word 'representation'
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 [b]US[/b] what you mean by "efficient".

axn 2009-10-23 16:01

[QUOTE=R.D. Silverman;193675]No, it is not. You are confusing the word 'representation'
<snip>
You need to tell [b]US[/b] what you mean by "efficient".[/QUOTE]

[QUOTE=JonBarleycorn;193665]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.[/QUOTE]

.

R.D. Silverman 2009-10-23 17:13

[QUOTE=axn;193676].

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.

[/QUOTE]

This definition makes no sense.
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.

CRGreathouse 2009-10-23 18:09

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)))};[/code]
in Pari to find them.

R.D. Silverman 2009-10-23 18:18

[QUOTE=CRGreathouse;193690]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)))};[/code]
in Pari to find them.[/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.

ewmayer 2009-10-23 18:29

[QUOTE=R.D. Silverman;193681]This definition makes no sense.
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.[/QUOTE]
I'm pretty sure axn meant to write "...gives at least as many significant digits as the sum of the number of digits of p and q", e.g. their digit counts sum to 3, which is to be compared to the number of significant digits in the decimal form of the resulting approximation to pi.

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):
[i]
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):

[b]Efficiency E(x;p,q) = log(x/|x - p/q|) / (log(p) + log(q)).[/b]
[/i]
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... [/code]
That is, using ~200 digits for each of p and q gives ~400 digits of accuracy in the resulting approximation, i.e. the total digits of accuracy is about the same as the total digits used to achieve it, hence E is around unity, making it less efficient that 22/7 and 355/113.

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?

CRGreathouse 2009-10-23 19:07

[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.

ewmayer 2009-10-23 19:37

[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".

m_f_h 2009-10-23 19:47

[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... ;-)

ewmayer 2009-10-23 20:50

[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.

Uncwilly 2009-10-24 00:17

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.

Raman 2009-10-24 06:43

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]

Batalov 2009-10-27 01:52

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?

JonBarleycorn 2009-10-27 04:25

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]

mart_r 2009-10-27 18:12

[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.

Uncwilly 2009-10-27 18:44

[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]

Batalov 2009-10-27 21:09

[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)

Raman 2009-10-28 15:14

There is a power of 7, very early that is surprisingly very close to a power of 10.
7[sup]510[/sup] ~ 10[sup]431[/sup]
This creates out a big number early in the continued fraction expansion for log 7.
How efficient is the approximation for log 7 as 431/510?

How good is the approximation for log 3 as 8519/17855?
Also, have a look up at the continued fraction expansions of the other logarithms too.
All these logarithms are to the base 10 only.
log 2, log 3, log 6, log 7, log 11...
log 5 = 1 - log 2: So that it creates up the same fractions within the continued fraction expansion essentially.

JonBarleycorn 2009-11-22 23:58

Efficient Integer Representations of Irrationals
 
What are the most efficient integer representations of the irrational numbers π and e?

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. Thus, an efficient representation will be both mnemonic and accurate, requiring no fewer digits to write than the accuracy gained.

For example, 22/7[FONT=&quot][/FONT] is an efficient integer representation of π (3.141592653589793238 …) since the sum of the integer digits (2 + 1) is 3 and 22/7 is accurate to just a bit better than 1 part in 791. Note that 22/7 – 1/791 [FONT=&quot][/FONT]= 355/113.

This representation, 355/113, is both efficient and memorable since it takes just 6 digits to get 7 digit accuracy (1 part in 3,748,629).

There was a nice discussion by ewmayer and CRGreathouse of a metric that gives a slight edge in efficiency to 22/7. But, 355/113 is reasonably memorable, and, it is the only representation to give a full digit of additional accuracy. Thus, this simple minded approach gives 355/113 the efficiency prize.

Finding a mnemonic representation for e (2.71828182845904523 …) is probably unnecessary because of the repeating ‘1828’ group. However, an efficient 3 digit representation is 19/7 which is good to about 1 part in 250. A 5 digit representation, 193/71, is good to 1 part in 35,675. An eight digit representation, 2721/1001, while accurate to 1 part in 9,076,277, is not efficient (8 digits needed for 7 digit accuracy). However, it is fairly easy to remember so it is being mentioned.

Others have pointed out that 49171/18089 = 2.718281828735. This is efficient and accurate to 1 part in 3,614,669,163. But, e itself, is just as easy to remember to 10 digits because of the repeating 1828 group so I cannot award 49171/18089 the prize.

Given that short term memory is limited to about 7 +/- [FONT=&quot][/FONT]2 chunks of information, further exploration with larger fractions is probably fruitless.

JB

philmoore 2009-11-23 00:18

Thanks for the concise essay, JB. I remember reading somewhere of an Arabic mathematician of the middle ages questioning why 22/7 was being used for pi when it was "common knowledge" that 355/113 was a much better approximation!

biwema 2009-11-23 21:32

[QUOTE=mart_r;193667]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.[/QUOTE]


There are efficient ways to write e.

(1 + 1/999!)^(999!)

gives more than 2500 digits of e.

Nevertheless i think it is not a valid solution because it is a general defintion of e:
(1+1/n)^n approximates e when n goes to infinity.

On the other hand the 31 digits approximation of pi is neat but neither a fraction as mentioined in this thread.

JonBarleycorn 2009-11-24 07:25

Forgive me if my calculator is not working right, but every time I tried log(640320 cubed + 744) / sqrt(163) I got 12.767145.. even when I used all the precision that Windows has to offer.

If I got it wrong then I owe [B]mart_r[/B] an apology.

I'm sorry I wasn't more clear that I was looking for 2 integers p, q such that p/q was memorable and a good representation of pi and e. I hope that I was more clear in my statement of the problem the second time around.

That said, some of the excursions were really first class, and, I was really impressed by the caliber of discourse that my little puzzle elicited! Thanks to all who responded.

JB

retina 2009-11-24 07:42

[QUOTE=JonBarleycorn;196856]Forgive me if my calculator is not working right, but every time I tried log(640320 cubed + 744) / sqrt(163) I got 12.767145.. even when I used all the precision that Windows has to offer.

If I got it wrong then I owe [B]mart_r[/B] an apology.

I'm sorry I wasn't more clear that I was looking for 2 integers p, q such that p/q was memorable and a good representation of pi and e. I hope that I was more clear in my statement of the problem the second time around.

That said, some of the excursions were really first class, and, I was really impressed by the caliber of discourse that my little puzzle elicited! Thanks to all who responded.

JB[/QUOTE]For the "log" press the "ln" button.

But your answer above, 12.767145.., is simply sqrt(163). Perhaps your forgot to press the "=" button?

davieddy 2009-11-24 17:07

The Well-tempered Klavier
 
2^(7/12) = ~3/2

So 7 "equal" semitones make nearly a "perfect fifth"
and 5 nearly a "perfect fourth"

Johann Sebastian

Raman 2012-03-24 18:06

One of the ways to compute the efficiency of an approximation for irrationals
by using a given fraction
x = p/q
is to compute the error ratio for
(10[sup]x[/sup])[sup]q[/sup] against (10[sup]p[/sup]) and then multiply it by using p.

Taking the value for x = log 2 ~ 3/10
for an example, the error ratio for
2[sup]10[/sup] against 10[sup]3[/sup] = 2.4% Multiplying it with the exponent 3, yields the ratio 7.2
for 6/20, 2[sup]20[/sup] against 10[sup]6[/sup] = 4.8576% Multiplying it with the exponent 6 yields the ratio 29.1456
So, this ratio increases when the numerator, denominator together are being multiplied by using the multiplier. Lowest terms always give the best approximation factor ratios.

For log 2, the ratio for
28/93 = 27.014312
59/196 = 25.584038
146/485 = 15.190773
[B]643/2136 = 10.474093[/B]
4004/13301 = 25.512806
30103/100000 = 3003.9994

For log 3, the ratio for
21/44 = 31.981105
73/153 = 7.52696
1074/2251 = 13.755307
[B]8519/17855 = 5.923131[/B]

The fun is that
73/153, when both the numerator, denominator are being multiplied by using 2232, yields 162936/341496
but that the value for 162935/341496 is always being a better closer approximation to the value for log 3

For [B]log 6[/B], undoubtedly the best approximation =
[COLOR=Blue][B]463/595[/B][/COLOR] with the ratio = [B]0.64197[/B]
against the fraction [I]7/9[/I], with such ratio, factor = [I]5.43872[/I]

For [B]log 7[/B], undoubtedly the best approximation =
[COLOR=Red][B]431/510[/B][/COLOR] with the ratio = [B]0.040418[/B]

This is being the effect for the big term very early within the continued fraction expansion for log 7 =
[SIZE=+1]1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]5[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]2[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]5[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]6[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[COLOR=Red][B][URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%287%29%2Flog%2810%29&precision=20&num_style=1#"]4813[/URL][/B][/COLOR]+ ...

For log 6,
[/SIZE]0 + [SIZE=+1] 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]3[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[I][URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]32[/URL][/I]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]1[/URL]+ 1/[B][URL="http://wims.unice.fr/wims/wims.cgi?session=AD5D17D723.3&lang=en&cmd=reply&module=tool%2Fnumber%2Fcontfrac.en&formula=log%286%29%2Flog%2810%29&precision=20&num_style=1#"]278[/URL][/B]+ ...[/SIZE]

[SIZE=2]Comparing against the efficient approximations values for PI
22/7 = 14.1224069
333/106 = 683.29723[/SIZE][SIZE=2]14[/SIZE]
[B][SIZE=2]355/113 = 2.46396731[/SIZE][/B][SIZE=+1]
[/SIZE]

Raman 2012-03-24 18:59

Question
 
Taking the continued fraction expansion for (log b)
gives out the powers of b (within the denominator), digits (within the numerator), that are being increasingly closer to the powers of 10.

[B]Question[/B]. Is there any way to give out the sequence for the powers of N that are being increasingly closer to the values for that following form, k.10[sup]n[/sup]?

For this example, consider with the following terms that are being

2[sup]171[/sup] ≈ 3.10[sup]51[/sup]
2[sup]1337[/sup] ≈ 3.10[sup]402[/sup]
2[sup]30075[/sup] ≈ 3.10[sup]9053[/sup]

2[sup]46[/sup] ≈ 7.10[sup]13[/sup]
2[sup]335[/sup] ≈ 7.10[sup]100[/sup]
2[sup]2471[/sup] ≈ 7.10[sup]743[/sup]
2[sup]15772[/sup] ≈ 7.10[sup]4747[/sup]
2[sup]157326[/sup] ≈ 7.10[sup]47359[/sup]

2[sup]53[/sup] ≈ 9.10[sup]15[/sup]
2[sup]538[/sup] ≈ 9.10[sup]161[/sup]
2[sup]2674[/sup] ≈ 9.10[sup]804[/sup]
2[sup]4810[/sup] ≈ 9.10[sup]1447[/sup]
2[sup]60150[/sup] ≈ 9.10[sup]18106[/sup]

Here are a few more good approximations
7.2[sup]2239[/sup] ≈ 71.10[sup]673[/sup]
3[sup]-14263[/sup] ≈ 66.10[sup]-6807[/sup]
3[sup]21973[/sup] ≈ 61.10[sup]10482[/sup]

3[sup]6565[/sup] ≈ 2.10[sup]3132[/sup] [COLOR=White]________[/COLOR] 3[sup]10475[/sup] ≈ 7.10[sup]4997[/sup] [COLOR=White]_______[/COLOR] 7.3[sup]17[/sup] ≈ 9.10[sup]8[/sup] [COLOR=White] _______[/COLOR] 3[sup]94[/sup] ≈ 7.10[sup]44[/sup]
3[sup]13130[/sup] ≈ 4.10[sup]6264[/sup] [COLOR=White]_______[/COLOR] 3[sup]4091[/sup] ≈ 8.10[sup]1951[/sup] [COLOR=White]________[/COLOR] 3[sup]35[/sup] ≈ 5.10[sup]16[/sup] [COLOR=White] ________[/COLOR] 3[sup]138[/sup] ≈ 7.10[sup]65[/sup]
3[sup]11290[/sup] ≈ 5.10[sup]5386[/sup] [COLOR=White]_______[/COLOR] 3[sup]4725[/sup] ≈ 25.10[sup]2253[/sup] [COLOR=White] _______[/COLOR] 3[sup]48[/sup] ≈ 8.10[sup]22[/sup] [COLOR=White]________[/COLOR] 7.3[sup]109[/sup] ≈ 71.10[sup]51[/sup]
3[sup]6566[/sup] ≈ 6.10[sup]3132[/sup] [COLOR=White] ________[/COLOR] 3[sup]3592[/sup] ≈ 66.10[sup]1712[/sup] [COLOR=White]_______[/COLOR] 3[sup]83[/sup] ≈ 4.10[sup]39[/sup][COLOR=White]_______[/COLOR][COLOR=White]_[/COLOR][COLOR=White]_[/COLOR][COLOR=White][/COLOR] 7.2[sup]103[/sup] ≈ 71.10[sup]30[/sup]
3[sup]12726[/sup] ≈ 7.10[sup]6071[/sup] [COLOR=White]_______[/COLOR] 3[sup]21447[/sup] ≈ 66.10[sup]10231[/sup] [COLOR=White]___[/COLOR][COLOR=White]_[/COLOR][COLOR=White]_[/COLOR] 3[sup]188[/sup] ≈ 5.10[sup]89[/sup]
3[sup]1840[/sup] ≈ 8.10[sup]877[/sup] [COLOR=White] _________[/COLOR] 3[sup]4118[/sup] ≈ 61.10[sup]1963[/sup] [COLOR=White] _______[/COLOR] 3[sup]223[/sup] ≈ 25.10[sup]105[/sup]

Raman 2012-03-30 07:14

[QUOTE=Raman;294058]
For this example, consider with the following terms that are being

27.2[sup]301[/sup] ≈ 11.10[sup]91[/sup][COLOR=LightBlue]________[/COLOR]267.2[sup]18[/sup] ≈ 7.10[sup]7[/sup]
1249.2[sup]56[/sup] ≈ 9.10[sup]19[/sup][COLOR=LightBlue]________[/COLOR]266999.2[sup]25[/sup] ≈ 8959.10[sup]9[/sup]
9.5[sup]53[/sup] ≈ 10[sup]38[/sup][COLOR=LightBlue]_____________[/COLOR]439.3[sup]13[/sup] ≈ 7.10[sup]8[/sup]
2[sup]317[/sup] ≈ 267.10[sup]93[/sup][COLOR=LightBlue]__________[/COLOR]7.3[sup]17[/sup] ≈ 904.10[sup]6[/sup]
2[sup]511[/sup] ≈ 67.10[sup]152[/sup][COLOR=LightBlue]__________[/COLOR]7.3[sup]6[/sup] ≈ 51.10[sup]2[/sup]
67.2[sup]27[/sup] ≈ 9.10[sup]9[/sup][COLOR=LightBlue]_______[/COLOR][COLOR=LightBlue]__[/COLOR][COLOR=LightBlue]__[/COLOR]7.3[sup]17[/sup] ≈ 9.10[sup]8[/sup]

[/QUOTE]

Taking the continued fraction expansion for (log b)
gives out the powers of b (within the denominator), digits (within the numerator), that are being increasingly closer to the powers of 10.

[B]Question[/B]. Is there any way to give out the sequence for the powers of N that are being increasingly closer to the values for that following form, k.10[sup]n[/sup]?

jasonp 2012-03-30 13:04

Yes, there is a standard estimate for the error term between a continued fraction and the decimal number it is supposed to represent, based only on the size of p and q (it's been ~15 years, I don't remember it). You can also prove that to get a better approximation of the error, you must use numbers larger than p and q.

Raman 2012-03-30 13:13

[QUOTE=jasonp;294824]Yes, there is a standard estimate for the error term between a continued fraction and the decimal number it is supposed to represent, based only on the size of p and q (it's been ~15 years, I don't remember it). You can also prove that to get a better approximation of the error, you must use numbers larger than p and q.[/QUOTE]

For example, to getting with this following sequence
2[SUP]46[/SUP] ≈ 7.10[SUP]13[/SUP]
2[SUP]139[/SUP] ≈ 7.10[SUP]41[/SUP]
2[SUP]335[/SUP] ≈ 7.10[SUP]100[/SUP]
2[SUP]2471[/SUP] ≈ 7.10[SUP]743[/SUP]
2[SUP]15772[/SUP] ≈ 7.10[SUP]4747[/SUP]
2[SUP]157326[/SUP] ≈ 7.10[SUP]47359[/SUP]

R.D. Silverman 2012-03-30 13:37

[QUOTE=jasonp;294824]Yes, there is a standard estimate for the error term between a continued fraction and the decimal number it is supposed to represent, based only on the size of p and q (it's been ~15 years, I don't remember it). You can also prove that to get a better approximation of the error, you must use numbers larger than p and q.[/QUOTE]

Look up Thue's Thm. or Liouville's Thm. --> Diophantine approximation

BTW, I does everyone know the theorem that in a well-defined sense
(I'll let people look it up if they are interested), the "Golden Ratio" is the
"most irrational" number that there is because it is the hardest to
represent as the ratio of integers. (in terms of the heights of the numerator
and denominator). Consider its CF expansion...

Raman 2012-04-22 01:37

[QUOTE=Raman;294054]
The fun is that
73/153, when both the numerator, denominator are being multiplied by using 2232, yields 162936/341496
but that the value for 162935/341496 is always being a better closer approximation to the value for log 3
[/QUOTE]

2098 = 2251 - 153
17855 = 7*2251 + 2098
17855 = 8*2251 - 153
17855 + 153 = 8*2251

[B]17855*19 + 2251
= (8*2251 - 153)*19 + 2251
= 152*2251 - 19*153 + 2251
= 153*2251 - 19*153
= 153*(2251 - 19)
= 153*2232
[/B]= 341496 ≡ 0 (mod 153)

162936 = 73*2232 ≡ 0 (mod 73)
162935 = 8519*19+1074
= 153 * 1074 - 73 * 19
≡ 72 (mod 73)

Thereby 44, 109, 153, 2098, 2251, 17855 are all being the denominator values for the continued fraction expansion for the real number log 3 itself

as such, again repeatedly, similar to the following repetitions as well
as follows
109 = 153 - 44
2098 = 13*153 + 109
2098 = 14*153 - 44
2098 + 44 = 14*153
2098 + 153 + 44 = 15*153
2251 + 44 = 15*153


All times are UTC. The time now is 14:05.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.