# HP Forums

Full Version: "Why do calculators get this wrong?" (YouTube)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Apparently, 11^6/13 = 156158413/3600 pi. Who knew?

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!
When I calculate 11^6/13/pi*3600, I get 156158412.9999625068535714091394323 which is rather close to being an integer...
(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!
(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
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.
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.)
(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?
Use SHOW to see full precision.
(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.
(07-20-2020 11:03 PM)Thomas Okken Wrote: [ -> ]Use SHOW to see full precision.