Post Reply 
"Why do calculators get this wrong?" (YouTube)
07-18-2020, 06:22 AM
Post: #1
"Why do calculators get this wrong?" (YouTube)
Apparently, 11^6/13 = 156158413/3600 pi. Who knew?



Find all posts by this user
Quote this message in a reply
07-19-2020, 03:24 PM
Post: #2
RE: "Why do calculators get this wrong?" (YouTube)
Nice video! And a pretty interesting question... when does the calculator 'succeed' in 'simplifying' and when does it not. Two examples from your description

11^6 ÷ 13 is presented as (156158413/3600)π
11^6 ÷ 17 is not presented as (119415257/3600)π

So, we wonder, what about the second approximation is different, to fail to 'simplify'? I pick these two examples because the denominator is the same. (I wonder if 3600 is an attractive denominator: the calculator goes off to seek a pi-based simplification because there are 360 degrees in a circle, so this might be an angle.)

In the first case, the LHS is
136273.923076923076...
and the RHS is
136273.923076955795...
but no doubt the calculator will have calculated some specific number of digits.

In the second case, the LHS is
104209.470588235294...
and the RHS is
104209.470588260314...

Looks like the calculator displays 10 digits (when it is so inclined) so is probably calculating to at least 12, although it might have the last digit wrong, and might do some rounding off to fewer digits than it calculates (but more than it displays.)

Having said which, mostly likely it will first divide by pi and then seek a rational approximation, so these are not the right numbers to compare.

And having said that, I see a commenter has found that the denominator needs to be a factor of 25200 for the search to work.

We should, then, calculate
11^6 / (13π) and compare to (156158413/3600)
11^6 / (17π) and compare to (119415257/3600)
probably to 12 or 14 digits.

So, first case is to compare
43377.3369444340
43377.3369444444
and the second case
33170.9047222142
33170.9047222222

which is still kind of interesting because the discrepancy falls the same way both times.

And yet: really we need to do the whole chained calculation in the way the Casio does, to the right number of digits, with the right error, and the right rounding. Will need one of those Casios to find out what that is!
Find all posts by this user
Quote this message in a reply
07-19-2020, 05:38 PM
Post: #3
RE: "Why do calculators get this wrong?" (YouTube)
When I calculate 11^6/13/pi*3600, I get 156158412.9999625068535714091394323 which is rather close to being an integer...
Visit this user's website Find all posts by this user
Quote this message in a reply
07-20-2020, 08:14 AM
Post: #4
RE: "Why do calculators get this wrong?" (YouTube)
(07-19-2020 05:38 PM)Thomas Okken Wrote:  When I calculate 11^6/13/pi*3600, I get 156158412.9999625068535714091394323 which is rather close to being an integer...
Good thought: perhaps the Casio divides by pi and then multiplies successively by the small prime factors of 25200 until it sees something rather close to an integer.

And yet, the failing example with 17 instead of 13 also comes out very close to an integer:
119415256.9999713...
In fact, even closer. Very odd.

Let's just see what happens if we do each step at 12 digits, rounded:
11^6/13 =[12r] 136273.923077
/pi[12r] =[12r] 43377.3369445
*3600 =[12r] 156158413 (integer)

whereas
11^6/17 =[12r] 104209.470588
/pi[12r] =[12r] 33170.9047221
*3600 =[12r] 119415257

But suppose we calculate to 12 digits and truncate instead of rounding:
11^6/13 =[12t] 136273.923076
/pi[12t] =[12t] 43377.3369442
*3600 =[12t] 156158412.999

11^6/17 =[12t] 104209.470588
/pi[12t] =[12t] 33170.9047222
*3600 =[12t] 119415256.999

Let's try again but with a rounded value of pi:
11^6/13 =[12t] 136273.923076
/pi[12r] =[12t] 43377.3369441
*3600 =[12t] 156158412.998

11^6/17 =[12t] 104209.470588
/pi[12r] =[12t] 33170.9047221
*3600 =[12t] 119415256.999

Not helping! I should perhaps have done 12 digit arithmetic throughout, instead of rounding or truncating a more precise number.

Do I have a 12 digit calculator... yes, I have an HP-30.
So, the 13 calculation comes to an integer.
As does the 17...
So I'm no closer!
Find all posts by this user
Quote this message in a reply
07-20-2020, 12:25 PM
Post: #5
RE: "Why do calculators get this wrong?" (YouTube)
(07-19-2020 03:24 PM)EdS2 Wrote:  ... I see a commenter has found that the denominator needs to be a factor of 25200 for the search to work.

Perhaps Casio is not going for "best" rational approximation, but simply multiply by 25200/pi

lua> k = 25200/pi       -- ≈ 8021.409131831525
lua> 11^6/13 * k
1093108890.9997375
lua> 11^6/17 * k
835906798.9997994

Rounded to 13 digits, first number is integer, but not the second

→ 11^6/13 ≈ 1093108891/25200 * pi = 156158413/3600 * pi
Find all posts by this user
Quote this message in a reply
07-20-2020, 12:48 PM
Post: #6
RE: "Why do calculators get this wrong?" (YouTube)
I think it just tries dividing by pi and looking for rational approximations using continued fractions. The one with denominator 3600 is simply the first one that is close enough.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-20-2020, 02:37 PM
Post: #7
RE: "Why do calculators get this wrong?" (YouTube)
Thanks Albert - 13 digits might well be the solution to the problem.

(Thomas, there's another part to the question: this isn't only about the approximations the calculator does find, but also, and more deeply, about those which it doesn't find.)
Find all posts by this user
Quote this message in a reply
07-20-2020, 10:47 PM (This post was last modified: 07-20-2020 10:51 PM by johanw.)
Post: #8
RE: "Why do calculators get this wrong?" (YouTube)
(07-19-2020 05:38 PM)Thomas Okken Wrote:  When I calculate 11^6/13/pi*3600, I get 156158412.9999625068535714091394323 which is rather close to being an integer...
When I do that on Free42 on Android in DISP ALL mode I get exactly 156158413.

Anyone with a DM42 to see what the result is on that machine?
Find all posts by this user
Quote this message in a reply
07-20-2020, 11:03 PM
Post: #9
RE: "Why do calculators get this wrong?" (YouTube)
Use SHOW to see full precision.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-21-2020, 12:12 AM
Post: #10
RE: "Why do calculators get this wrong?" (YouTube)
(07-20-2020 10:47 PM)johanw Wrote:  
(07-19-2020 05:38 PM)Thomas Okken Wrote:  When I calculate 11^6/13/pi*3600, I get 156158412.9999625068535714091394323 which is rather close to being an integer...
When I do that on Free42 on Android in DISP ALL mode I get exactly 156158413.

Anyone with a DM42 to see what the result is on that machine?

It gets the exact same result as Free42, which is good, since it actually is Free42. Smile

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
07-21-2020, 02:57 PM
Post: #11
RE: "Why do calculators get this wrong?" (YouTube)
(07-20-2020 11:03 PM)Thomas Okken Wrote:  Use SHOW to see full precision.
OK,then I see your result.
Find all posts by this user
Quote this message in a reply
07-21-2020, 11:09 PM
Post: #12
RE: "Why do calculators get this wrong?" (YouTube)
(07-21-2020 02:57 PM)johanw Wrote:  
(07-20-2020 11:03 PM)Thomas Okken Wrote:  Use SHOW to see full precision.

OK,then I see your result.

I forgot to mention: you can also use Copy, from the main menu. That copies the contents of the X register to the system clipboard, in full precision, regardless of the display mode.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-22-2020, 08:11 AM
Post: #13
RE: "Why do calculators get this wrong?" (YouTube)
(07-20-2020 02:37 PM)EdS2 Wrote:  Thanks Albert - 13 digits might well be the solution to the problem.
I should have said more: it's the idea that multiplying by 3600 and testing for an integer result is a likely approach, combined with the observation that the two cases produce results with different near-integer sizes, such that one case has more digits beyond the point. So the closer match of the /17 case no longer looks closer, because the /13 case lost one digit of precision.

Very interesting.
Find all posts by this user
Quote this message in a reply
Post Reply 




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