# HP Forums

You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I was curious as how the the new Swiss Micros DM42 accuracy compared with other calculators, so I performed the calculation of -2 ln e^x on several calculators with the following results:

DM42 > -2.000 -i2.316E-34

HP 42s > -2.00 -i4.14E-13

HP 50g > -2.000 -i4.135E-13

HP Prime > -2.000 -i4.135E-13

So, the HP calculators all have the same error in the imaginary part which should be zero, but the DM42 error is 260% lower.

It would be interesting to see how these calculators compare with other operations, data types and functions.
(12-20-2017 07:45 PM)Michael de Estrada Wrote: [ -> ]I was curious as how the the new Swiss Micros DM42 accuracy compared with other calculators...

I'd guess that the only other one that likely is close is the WP-34S.
If I'm reading it right (I'm not the most adept with how the 34S deals with complex numbers), the result of the operation is
-2 + i4.769e-16
(12-20-2017 07:45 PM)Michael de Estrada Wrote: [ -> ]So, the HP calculators all have the same error in the imaginary part which should be zero, but the DM42 error is 260% lower.

One should consider that the DM42 uses 34 digits while the HP calcs 15 (or 12?).

Sure this December is the month of accuracy discussions!
For example.
- This very post
- other posts that appear here and there in other threads.

Someone should also write, though, that if the accuracy seems not that great, it depends on what one measures and how. If I am going to use planck units to measure something and my best measurement tool has the scale in millimeters, then my concerns should not be about the accuracy of the calculator, rather somewhere else.
(12-20-2017 08:18 PM)Logan Wrote: [ -> ]If I'm reading it right (I'm not the most adept with how the 34S deals with complex numbers), the result of the operation is
-2 + i4.769e-16

Yes, that is correct. The WP34S uses the X register for the real part and the Y register for the imaginary part. To perform functions in complex mode the function key is preceded by the CPX key. It’s very simple and intuitive IMO.

The thing about the WP34S is that you can switch to double precision mode to increase the accuracy of calculations. Using h MODE DBLON and performing -2 ln e^x yields the result
-2.000 -i2.316E-34, which is the same result as the DM42.
The part that was throwing me off was having to press CPX (which I only happened to notice, not having looked at any documentation for the calculator yet), beforehand, which almost necessitates knowing I'm going to receive a complex result (in the case of ln(-2) not too bad). I'm used to the behavior on say, the 42s, which I can set to display the result as complex, regardless of whether I intend the result to be complex or not.

For the 34s, it has to do with needing two lines to display rectangular and polar I'm sure. It didn't take terribly long to figure out. If I'd spent more time with my 15c I'm sure it would have seemed natural
(12-20-2017 07:45 PM)Michael de Estrada Wrote: [ -> ]I was curious as how the the new Swiss Micros DM42 accuracy compared with other calculators, so I performed the calculation of -2 ln e^x on several calculators with the following results:

You cannot assess the accuracy by comparing the imaginary part of the result to zero. If it actually is zero something has gone wrong. ;-)

(12-20-2017 07:45 PM)Michael de Estrada Wrote: [ -> ]So, the HP calculators all have the same error in the imaginary part which should be zero, but the DM42 error is 260% lower.

The non-zero imaginary part is not an "error", it's the exact result of the performed calculation.

The natural log of –2 is ln 2 + pi·i. Both the real and the imaginary part of the true log are irrational numbers, i.e. they have infinitely many digits. So any calculator with 10, 12 or even 1000 digits is not able to give the exact result. The best you can get is a 10, 12 or 1000-digit approximation. And this is what the HPs return: instead of ln 2 + pi·i they give 0,693147180560 + 3,14159265359 i. Which is as good as it gets on a 12-digit device.

Now, if this value is exponentiated, of course you do not get exp(ln 2 + pi·i) = –2. Instead you get exp(0,693147180560 + 3,14159265359 i) = –2,000000000000109...–4,13542...E–13 i. Which is exactly what the HPs return here.

Instead of 12-digit numbers the DM42 uses 34 digits. Here the same calculation with ln 2 and pi rounded to 34 significant digits yields –2 – 2,3160566...i. Again, the non-zero imaginary part is not an error but the exact result for exp(0,693147...+3,14159...i) instead of exp(ln 2 + pi·i).

The imagary part of the result should be approx. 2 sin pi. But since pi has only 12 digits the sine is not zero but approx. the difference between the 12-digit value and "true pi". 3,14159265359 – pi ~ –2,0676 E–13, and 2x this is –4,135 E–13. Or +4,769 E–16 for 16 digits or –2,316 E–34 for 34 digit precision.

(12-20-2017 11:36 PM)Logan Wrote: [ -> ]The part that was throwing me off was having to press CPX (which I only happened to notice, not having looked at any documentation for the calculator yet), beforehand, which almost necessitates knowing I'm going to receive a complex result (in the case of ln(-2) not too bad).

By pressing CPX on the 34s you do not tell the calculator to return a complex result. Instead, you tell it to calculate the function of a complex number in X and Y (instead of a real number in X). Of course the result may be real: Try 1 ENTER 0 CPX x² and get –1 as the correct answer.

So there is no need to know if the result is going to be complex or not. CPX tells the calculator that your input is complex.

Dieter
Thanks, Dieter. You have rightly pointed out that I have used the word “accuracy”, whereas I truly should have used “precision” instead.
(12-21-2017 07:33 PM)Michael de Estrada Wrote: [ -> ]Thanks, Dieter. You have rightly pointed out that I have used the word “accuracy”, whereas I truly should have used “precision” instead.

I just wanted to point out that the non-zero imaginary part is the exact and desired result which a correctly working calculator is supposed to return.

It's essentially the same story as with calculating (√2)². If the result on a 10- or 12-digit calculator is exactly 2 there's something going on behind your back. ;-)

Dieter
Does anyone who owns a DM42 & WP-34s know of any calculation that shows better precision on the DM42 than the WP-34s in double precision mode?

My guess is that they are about the same. I welcome any input or examples that show otherwise. If true this sort of debunks the Swiss Micros claim that the DM42 is
"The most precise calculator in the world - second to none!"
(12-22-2017 12:19 AM)BarryMead Wrote: [ -> ]Does anyone who owns a DM42 & WP-34s know of any calculation that shows better precision on the DM42 than the WP-34s in double precision mode?

I know of some cases where Intel's maths library (i.e the DM42) rounds incorrectly but the 34S doesn't. I'm not aware of any cases where the converse is true.

Pauli
newRPL is capable of arbitrary precision which is better than either.

Pauli
(12-21-2017 07:01 PM)Dieter Wrote: [ -> ]If it actually is zero something has gone wrong. ;-)

...

The non-zero imaginary part is not an "error", it's the exact result of the performed calculation.

I'm going to take the bait and play advocate of the devil here. If the argument is "exactly" 3.14159265359 is one thing, but if that number came from other calculations with roundoff error, the number is not exact, it is approximated.
We don't really know what the rest of the digits were going to be if we had more precision, so that number represents a range from [3.141592653585 to 3.141592653595[ which is the set of numbers that after rounding would've resulted in 3.14159265359.
Now that means sin(3.14159265359) could be any result in the range
[4.7932384626...E-12 to -5.2067615373...E-12[
Since asin(x) on all those numbers would produce the correct result of 3.14159265359.
By "snapping" the argument to 3.14159265359(00000000....) we are fixing the result of the function sin() to -2.0676153735E-13, but that doesn't make it the "exact" result, any number in the range above is just as exact, including the zero!
The choice of grid to "snap" our discreet results into can be changed arbitrarily. For example, newRPL uses degrees internally to "snap" angles to a grid, so sin(x) will convert that number to degrees 3.14159265359*(180/pi) = 180.000000000011846563 (bold numbers are the 12-digit precision limit). Since the original angle maps to 180 degrees with 12 digits, we can "snap" the result to 180
degrees and apply the function, obtaining zero for sin(180).
All this operation did is change the "snap" grid to something that actually includes the relevant points in the circle.
Is returning zero any better than the other result you called "exact"? Not really, it's just another value within that range of values that are acceptable results, but sure looks a lot cleaner on the screen.

Why doesn't your example round to even? That is the usual way to avoid bias. 3.141592653585 would then round to 3.14159265358.

Pauli
Claudio, you make an interesting point.

When a calculation goes to N digits, the result is typically truncated to M digits where (M < N) and the final digits determine whether to round UP or DOWN the M'th digit. This gives an error range.
When a value is passed to a second function, it would be interesting to [optionally] see that error range used to produce a range of outputs, OR for the final range to be specified:

X_min = -5.2067615373...E-12
X_max = 4.7932384626...E-12
OR :
X = 0 +/- 5.2 E-12
(12-22-2017 12:19 AM)BarryMead Wrote: [ -> ]Does anyone who owns a DM42 & WP-34s know of any calculation that shows better precision on the DM42 than the WP-34s in double precision mode?

My guess is that they are about the same. I welcome any input or examples that show otherwise. If true this sort of debunks the Swiss Micros claim that the DM42 is
"The most precise calculator in the world - second to none!"

Well, if they are on par, none of them is second to another. ;)
(12-22-2017 04:39 AM)Claudio L. Wrote: [ -> ]Now that means sin(3.14159265359) could be any result in the range
[4.7932384626...E-12 to -5.2067615373...E-12[
Since asin(x) on all those numbers would produce the correct result of 3.14159265359.

I do not agree.
We cannot know where the input came from and have to take it one step at a time.
SIN(3.14159265359) = SIN(PI-x) = SIN(x) ~= x for small x, and that is the only correct result, x = -2.06761537357e-13, incidentally correct to 12 digits, a feat as yet unmatched in TI calculators (correct me if I'm wrong)
It is not because ASIN(x) produces 3.14159265359 for a myriad numbers that they would all be the correct result for SIN(3.14159265359)?
Would you like your 12-digit calculator to return 1e-250 for SQRT(0)?

Cheers, Werner
(12-22-2017 07:58 AM)Werner Wrote: [ -> ]We cannot know where the input came from and have to take it one step at a time.

And for that reason I agree with Claudio: every number should be interpreted as the interval of values that would round to that value.

@Claudio: I have got my HP 50g now. Waiting for newRPL with interval arithmetic :-)
(12-22-2017 07:58 AM)Werner Wrote: [ -> ]Would you like your 12-digit calculator to return 1e-250 for SQRT(0)?

No. Underflows should generate an error and so unless you are supporting signed zeroes 0 represents just that: zero.

Or would you really want your calculator to return 0 for 1/[something huge]?
(12-22-2017 12:43 AM)Paul Dale Wrote: [ -> ]newRPL is capable of arbitrary precision which is better than either.

Pauli

Pauli: Since newRPL equipped calculators are better than either the DM42 or WP-34s, then that really does DEBUNK the Swiss Micro's claim of second to none! I wasn't aware that newRPL had arbitrary precision! That is amazing for a portable calculator. I thought this capability only existed on desktop computers. I will have to give newRPL a try on my HP-50G. Thanks for the tip.
Pages: 1 2
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :