HP Forums
Just a curious mathematical result - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Just a curious mathematical result (/thread-10280.html)



Just a curious mathematical result - Valentin Albillo - 03-05-2018 10:54 PM

Hi all,

Just to let you know about a curious mathematical result I discovered recently. In radians:

      Sin(9*(Sin(1) + Cos(40))) =    0.999999999999999830826985368...

which differs from the integer 1 by about 1e16. If you compute it on a 12-digit machine (such as the HP-71B) y will probable get evaluated as exactly 1. The correct value requires more than 12 digits, in a pinch the Windows calculator will do.

¿ Nice, isn't it ?

V.
.


RE: Just a curious mathematical result - Carsen - 03-05-2018 11:33 PM

This little problem makes me appreciate Longfloat and newRPL very much.


RE: Just a curious mathematical result - Valentin Albillo - 03-05-2018 11:33 PM

(03-05-2018 11:08 PM)Mike (Stgt) Wrote:  Should be added here.
Ciao.....Mike

(sorry for the typos there in my original post, virtual keyboards can be a chore and I didn't have time to properly proofread)


Yes, I think you're right so I've just contacted the people in charge of the web page you mentioned to let them know and perhaps consider including it there.

By the way, Mike, did you have a look at the PDF document I suggested in my reply to your post on Namir's thread, namely:

AMS - Computing square root of 2 to 1,000,000 digits

The document discusses algorithms used in the past to compute square roots to thousands of digits and in particular the one used to reach 1,000,000 digits.

Also, to check your very own implementation simply google "square root of 2 to 1 million digits" and you'll immediately find a link to the full result.

Regards.
V.
.


RE: Just a curious mathematical result - pier4r - 03-06-2018 07:07 AM

A question would be. How did you get that formula in the first place? It is not a common one.


RE: Just a curious mathematical result - DA74254 - 03-06-2018 01:59 PM

Works on SM DM42 but gives "1" in Prime "home" rpn and "1." in Prime CAS


RE: Just a curious mathematical result - TheKaneB - 03-06-2018 02:10 PM

(03-06-2018 01:59 PM)DA74254 Wrote:  Works on SM DM42 but gives "1" in Prime "home" rpn and "1." in Prime CAS

Well, it's the correct answer given the HP Prime's number of digits / bits in the two modes.


RE: Just a curious mathematical result - Jake Schwartz - 03-06-2018 03:02 PM

...and the WP-34S in double-precision mode yields
0.9999999999999998308269853686957601


Jake


RE: Just a curious mathematical result - DA74254 - 03-06-2018 03:05 PM

(03-06-2018 02:10 PM)TheKaneB Wrote:  
(03-06-2018 01:59 PM)DA74254 Wrote:  Works on SM DM42 but gives "1" in Prime "home" rpn and "1." in Prime CAS

Well, it's the correct answer given the HP Prime's number of digits / bits in the two modes.

Yes, I'm aware of that. But if you calculate a large number, say; 99^20, you may hit "view" and you can obtain a number 100's of digits long. Then 1/x and you get a resiprocal of that large number. Though, the "1." in CAS is absolute. You won't be able to evaluate it, only obtain the approx version of the formula stated by OP.


RE: Just a curious mathematical result - jebem - 03-06-2018 04:15 PM

(03-06-2018 01:59 PM)DA74254 Wrote:  Works on SM DM42 but gives "1" in Prime "home" rpn and "1." in Prime CAS

Yes, HP Prime on CAS mode gives me 1. for approx(SIN(9*(SIN(1)+COS(40))))
However doing 1-Ans gives me 3.5527136788 E-15

So, not exactly the same answer of absolute 1 as got on Home mode, where 1-Ans gives exactly 0.

Further quick searching on google shows a few answers for the above CAS result of 3.5527136788 E-15 for instance here.
Apparently this value corresponds to 8 ^ -16 or 16 ^ -12 or -64 ^ -8 (i didn't take the time to check it).

Tim and Cyrille have been posting some information on the numbers internal representation being different on Home and on CAS modes, and that can explain the different results when trying to get the hidden guard digits on each mode.


RE: Just a curious mathematical result - BartDB - 03-06-2018 04:35 PM

(03-06-2018 03:05 PM)DA74254 Wrote:  
(03-06-2018 02:10 PM)TheKaneB Wrote:  Well, it's the correct answer given the HP Prime's number of digits / bits in the two modes.

Yes, I'm aware of that. But if you calculate a large number, say; 99^20, you may hit "view" and you can obtain a number 100's of digits long. Then 1/x and you get a resiprocal of that large number. Though, the "1." in CAS is absolute. You won't be able to evaluate it, only obtain the approx version of the formula stated by OP.

Hi,

The Prime can do large integers, but for floating point numbers will always be 12 digit accuracy (actually CAS is double precision floating point, which could be 15 digits - but i'm not sure the developers will guarantee this).
.


RE: Just a curious mathematical result - BartDB - 03-06-2018 04:44 PM

(03-06-2018 04:15 PM)jebem Wrote:  
(03-06-2018 01:59 PM)DA74254 Wrote:  Works on SM DM42 but gives "1" in Prime "home" rpn and "1." in Prime CAS

Yes, HP Prime on CAS mode gives me 1. for approx(SIN(9*(SIN(1)+COS(40))))
However doing 1-Ans gives me 3.5527136788 E-15

So, not exactly the same answer of absolute 1 as got on Home mode, where 1-Ans gives exactly 0.

Further quick searching on google shows a few answers for the above CAS result of 3.5527136788 E-15 for instance here.
Apparently this value corresponds to 8 ^ -16 or 16 ^ -12 or -64 ^ -8 (i didn't take the time to check it).

Tim and Cyrille have been posting some information on the numbers internal representation being different on Home and on CAS modes, and that can explain the different results when trying to get the hidden guard digits on each mode.

1 - sin(9*sin(1)+cos(40))) should yield 1.69173...E-16, so the Prime is quite wrong.

CAS approx. is double precision floating point which gives 15 digit accuracy (17 at most, but for Prime CAS I have found it to be seldom better than 15). However, as you have demonstrated, more digits can be found by subtracting the more significant digits - but I have found they are usually wrong. So I would not rely on it.
.


RE: Just a curious mathematical result - BartDB - 03-06-2018 04:49 PM

(03-05-2018 11:08 PM)Mike (Stgt) Wrote:  
(03-05-2018 10:54 PM)Valentin Albillo Wrote:  Hi all,

Just to let you know about a curious mathematical result I discovered recently. In radians:

Sin(9*(Sin(1) + Cos(40))) = 0.999999999999999830826985368...

which differs from the integer 1 by about 1e16. If you compute it on a 12-digit machine (such as the HP-71B) y will probable get evaluated as exactly 1. The correct value requires more than 12 digits, in a pinch the Windows calculator will do.

¿ Nice, isn't it ?

V.
.

Should be added here.

Ciao.....Mike

These type of equations should be called "Rube Goldberg methods of obtaining almost integers" Smile
.


RE: Just a curious mathematical result - KeithB - 03-06-2018 05:53 PM

Or weird approximations of pi.
18*(sin(1) + cos(40)) ~= pi


RE: Just a curious mathematical result - EdS2 - 03-07-2018 11:42 AM

(03-06-2018 05:53 PM)KeithB Wrote:  Or weird approximations of pi.
18*(sin(1) + cos(40)) ~= pi

That's a good unpacking. The original outer use of sin() is mapping something close to pi/2 to something much closer to 1. It looks impressive - I was impressed - but it's a trick.


RE: Just a curious mathematical result - Thomas Okken - 03-07-2018 02:23 PM

(03-07-2018 11:42 AM)EdS2 Wrote:  The original outer use of sin() is mapping something close to pi/2 to something much closer to 1.

Yep. In the same vein, sin(11/7) = 0.9999998...