asin(acos(atan(tan(cos(sin(7)))))) Message #1 Posted by Valentin Albillo on 11 Feb 2005, 10:12 a.m.
Hi, all:
Though this is essentially a commentary to a posting by Ralph, I'm starting a new thread as my commentary isn't directly related to the original thread, "Some 49G+ Limitations".
Ralph posted:
"c)asin(acos(atan(tan(cos(sin(7))))))
[...]
HP41CX(6.999519575) worse than HP49G+, HP48G
Lest people would think that the HP-41CX has serious accuracy problems with this particular computation, let's make clear that this lack of accuracy stems from the fact that this example is very ill-conditioned, as the cosine function is being evaluated for a very small argument, where serious cancellation is taking place. Let's see:
You can see the loss easily, just subtract this result from 1 again, to get 0.0000022621, which is missing its last 5 digits of accuracy (namely ...09806). So, it's no wonder the HP-41CX gives such a seemingly "inaccurate" final result. The loss would be even greater if still smaller arguments were tested, for instance let's try 1 instead of 7:
asin(acos(atan(tan(cos(sin(1)))))) = 0.9990167403
which loses 7 digits of accuracy instead of 5-6 in the original example. Now, just to further see that the problem has nothing to do with the HP-41CX's internal algorithms, let's evaluate this second, worse example, but this time in RADians instead of DEGrees:
XEQ RAD
asin(acos(atan(tan(cos(sin(1)))))) = 1.000000000
which gives a perfect result back and clearly shows the true accuracy, once we're no longer dealing with an ill-conditioned problem. Another revealing test, this time in the original DEGrees setting, is to exchange the order of evaluation of SIN and COS (and also that of ACOS and ASIN as well):
XEQ DEG
acos(asin(atan(tan(sin(cos(7)))))) -> 6.999999972
and you can see that we have a decent result, with a mere loss of slightly over one significant digit, because this time the argument for COS is 7º, instead of 0.1218º, i.e., almost 60 times greater.
I hope this helps to understand what's happening and why a seemingly poor performance while doing the original test doesn't necessarily mean same poor overall performance, far from it. The original test is a contrived, ill-conditioned case, not to be regarded as a valid measure of general accuracy for the model tested.
Best regards from V.
Edited: 11 Feb 2005, 10:22 a.m.
|