Post Reply 
Decimals to improper fractions program?
06-09-2018, 12:55 AM
Post: #16
RE: Decimals to improper fractions program?
.
Hi, Dieter:

(06-08-2018 08:17 AM)Dieter Wrote:  No sarcasm intended. [...] This simply reminded me of a program I saw somewhere (can't remember where exactly it was) where indeed a numeric value was replaced with a fraction that required more digits and thus more program steps than coding the value directly.

Understood. I thought that you were sarcastically referring to one of my 12C's programs in which I supposedly did that and I couldn't remember which one.

Quote:
(06-07-2018 10:39 PM)Valentin Albillo Wrote:  I said "almost". Rounded to 8 significant digits Pi is 3.1415927 while 355/113 is 3.1415929, so the 8th digit is just 2 ulps off (out of a possible 10) so my "almost" is more than justified.

OK, let's agree to disagree on this.

Not necessarily. Rational people can "agree to disagree" in fields which are amenable to subjective opinions but Mathematics is not one of them, Mathematics is fact-based and evidence-based, so there's little or no place for subjectivism. No one can rationally "agree to disagree" whether 11111 is prime or not, you just produce its factors or lack of prime factorization and that settles the question once and for all.

This said, if you'd be so kind as to indulge me on this, let's analyze the subject matter, for the benefit of our readers if nothing else. I stated the following:

      "unlike 355/113, which gets almost 8 significant digits using just 6"

and you then stated:

      "355/113 = 3,14159292... which agrees with pi in exactly 7 significant digits. Both truncated (3,141592) and rounded (3,141593). The 8th significant digit is 3 units off".

Well, let's see if you agree with the following:

      1) The rounded value of Pi to 8 significant digits is 3.1415927. Once rounded, the value becomes exactly 3.141592700000... Do you agree ?

      2) The rounded value of 355/113 to 8 significant digits is 3.1415929. Once rounded, the value becomes exactly 3.141592900000... Do you agree ?

      3) Both rounded values differ from one another by exactly 2 units in the last place, not 3, not 2.6676, just 2. Do you agree ?

      4) Two values which exactly agree to 7 significant digits may differ in their last, 8th digit by from 0 to 9 units in the last place. If they differ by 0 ulps, they can be said to exactly agree to 8 digits, and if they differ by 1 or 2 ulps they can be said to almost agree to 8 digits. If they differ by 3, 4, 5, 6, 7, 8 or 9 ulps that would not be the case, but for just 1 or 2 ulps the qualifier "almost" is justified.

Do you agree ?

My intention when I stated this almost-agreement to 8 digits while using just 6 (3,5,5,1,1,3) was to get home the fact that 355/113 is a most remarkable approximation to Pi, relatively much better than any other which might agree with Pi to more significant digits but at the cost of using relatively much longer numerators and denominators.

That's not a subjective opinion but a mathematical fact that can be substantiated by looking at Pi's continued fraction and at Pi's convergent fractions.

1) Pi's continued fraction is (3,7,15,1,292,1,1,1,2,1,...), which can be readily evaluated:

>3+1/(7+1/(15+1/(1+1/(292+1/(1+1/(1+1/(1+1/(2+1/1)))))))), PI

      3.14159265359       3.14159265359


so it agrees to a full 12 significant digits with the terms used. Notice that big 292 term, much bigger that any of the other terms. This indicates that the equivalent fraction stopping at the previous term, 1, is so good that you need to go all the way to 292 to try and get something better.

That extremely good fraction, the one with continued fraction (3,7,15,1) is precisely 355/113, while the following fraction that improves on it is 103993/33102, using 11 digits in all vs. 6 digits.

2) Pi's convergent fractions can be readily obtained from the continued fraction expansion and are as follows:

      3/1            = 3
      22/7           = 3.14285714286
      333/106        = 3.14150943396
      355/113        = 3.14159292035
      103993/33102   = 3.14159265301
      104348/33215   = 3.14159265392
      208341/66317   = 3.14159265347
      312689/99532   = 3.14159265362
      833719/265381  = 3.14159265358
      1146408/364913 = 3.14159265359


Notice the big increase in the sizes of numerator and denominator between 355/113 and the next convergent, 103993/33102. There's no similar huge difference in size between other consecutive convergents, because the terms of Pi's continued fraction are so small in comparison and that's what makes 355/113 so exceptionally accurate.

Do you agree ? :-)

Quote:
(06-07-2018 10:39 PM)Valentin Albillo Wrote:  Sorry to have ruffled your feathers.

No problem – no ruffling has occured.

Glad to know. Have a nice weekend.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Decimals to improper fractions program? - Valentin Albillo - 06-09-2018 12:55 AM



User(s) browsing this thread: 1 Guest(s)