(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