My son is now using a DM42 full-time. He put the 48GX down a few months ago. A big step for an eighth grader.
He brought to my attention tonight that taking the square root of <0 1i> and then squaring it does not give <0 1i> as the answer. <-2E-34 1i>. The HP42S and the 48GX give <0 1i>.
Is this a known thing?
(SQRT 0 1i ) ^2
(SQRT 0 1i ) ^2
Waiting for SM to release DM42 hardware with one additional row of keys.
DM42, DB48X, DM32, HP42s, DM41X, HP35s, DM41L
Raising a next generation RPN/RPL user.
DM42, DB48X, DM32, HP42s, DM41X, HP35s, DM41L
Raising a next generation RPN/RPL user.
Re: (SQRT 0 1i ) ^2
I wouldn't worry too much, 2e-34 is pretty much zero for most applications.
And at least, 0.5 SQRT X↑2 yields 0.5 in ALL mode.
But take a look with the SHOW, and it's actually 4.999999999999999999999999999999999e-1
4 suceeded by 33 nines. So the 2e-34 above is simply showing you the accuracy of the DM42 I guess
In the Free42, Thomas Okken could perhaps decide to loose the last significant digit, and round all results to 33 digits?
But I think that would be a shame, I like all 34 digits
And at least, 0.5 SQRT X↑2 yields 0.5 in ALL mode.
But take a look with the SHOW, and it's actually 4.999999999999999999999999999999999e-1
4 suceeded by 33 nines. So the 2e-34 above is simply showing you the accuracy of the DM42 I guess
In the Free42, Thomas Okken could perhaps decide to loose the last significant digit, and round all results to 33 digits?
But I think that would be a shame, I like all 34 digits
/Rudi
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
Re: (SQRT 0 1i ) ^2
This is known and rises every once and a while.
Explanation:
Calculators calculate with a finite number of digits. So even 1/3 doesn't really equal 1/3 in any calculator exactly but only (!) 0.333333333333333333333333333 (stopping after a finite number of threes). Hence, 3 x 1/3 results in 0.999999999999999999999 or alike. Now, it depends on the number of digits indicated vs. the number of digits calculated what will happen: if the latter is greater than the first, you can use the extra digits for rounding.
Example:
0.+i×1. SQRT ENTER × returns 0.+i×1. displayed on the WP43S.
Actually, this is 0. + ix0.999 999 999 999 999 999 999 999 999 999 999 9, however, and I know there are 5 digits more under the hood.
As Rudi stated, a relative error of 10^(-34) is irrelevant for all real-world calculations.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
-
- Posts: 47
- Joined: Sun Mar 11, 2018 5:37 pm
- Location: France
Re: (SQRT 0 1i ) ^2
Nice finding ! This is a minor Free42 accuracy flaw:
Doing SQRT( 0+1i ) is giving:
0.7071067811865475244008443621048490 +
0.7071067811865475244008443621048491 i
Since the real and imag parts are not equal (as they should be), squaring back this number doesn't give exactly 0 for the real part.
Some technical background: HP calculators are using degrees (not radians) to convert complex numbers to polar form, for internal operations.The HP42S and the 48GX give <0 1i>.
This ensures better results in many cases (like this one).
Edited: my comment just above is not relevant for that particular case.
Here is an example of a similar accuracy flaw on the HP-42S:
SQRT (0 + 0.4652 i) gives:
0.482286222071 +
0.482286222072 i
and squaring it back gives: -9.65E-13 + 0.4652 i
J-F
Re: (SQRT 0 1i ) ^2
Thank you all for the generous responses. We assumed it was something like this because of the other little things we have caught. There is little boy big on math and RPN reading the responses with much glee this evening.
He has a love for complex numbers to boot.
He has a love for complex numbers to boot.
Waiting for SM to release DM42 hardware with one additional row of keys.
DM42, DB48X, DM32, HP42s, DM41X, HP35s, DM41L
Raising a next generation RPN/RPL user.
DM42, DB48X, DM32, HP42s, DM41X, HP35s, DM41L
Raising a next generation RPN/RPL user.
-
- Posts: 1102
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: (SQRT 0 1i ) ^2
Indeed! Complex sqrt is missing special cases for pure real and pure imaginary arguments. That's an oversight.J-F Garnier wrote: ↑Tue Jun 21, 2022 9:25 amNice finding ! This is a minor Free42 accuracy flaw:
Doing SQRT( 0+1i ) is giving:
0.7071067811865475244008443621048490 +
0.7071067811865475244008443621048491 i
Since the real and imag parts are not equal (as they should be), squaring back this number doesn't give exactly 0 for the real part.
Re: (SQRT 0 1i ) ^2
Taking the square root of a 15 digit integer, then squaring the result, will usually show a loss of precision.
🖩 DM16L, DM42
Re: (SQRT 0 1i ) ^2
My DM42 handles SQRT of an large integer rather fine, no rounding errors in the below, which results in zero.
Try pressing SHOW after entering the 34 digit integer, all digits are there, even though the DM42 displays 1,23456789012E33 in ALL mode.
Try pressing SHOW after entering the 34 digit integer, all digits are there, even though the DM42 displays 1,23456789012E33 in ALL mode.
Code: Select all
1234567890123456789012345678901234
ENTER
SQRT
X^2
-
/Rudi
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
DM-42 (s/n 06999), HP-42S, HP-35s, HP-11c, HP-32SII (ex HP-41CV, ex HP-75C, ex HP-48G + a lot, really lot of a accessories)
Denmark
Re: (SQRT 0 1i ) ^2
My WP43S can handle the square root of a 83-digit integer without any losses. Maybe it works for even longer integers as well but I can't prove it there.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
-
- Posts: 47
- Joined: Sun Mar 11, 2018 5:37 pm
- Location: France
Re: (SQRT 0 1i ) ^2
A simple counter-example:rudi wrote: ↑Wed Jun 22, 2022 10:10 amMy DM42 handles SQRT of an large integer rather fine, no rounding errors in the below, which results in zero.
Try pressing SHOW after entering the 34 digit integer, all digits are there, even though the DM42 displays 1,23456789012E33 in ALL mode.Code: Select all
1234567890123456789012345678901234 ENTER SQRT X^2 -
3E32 SQRT X^2 -> 299999999999999999999999999999999.9
No bug here, it's just due to the finite representation of SQRT(3E32) with 34 digits.
This is machine-dependent, the usual well-known example on HP Saturn machines is SQRT(2) instead of SQRT(3).
J-F