Strange matrix results for HP-71B Math ROM


Following a recent long
about matrix calculation accuracy on various calculators, I was quite surprised by the HP-71B Math ROM matrix performance, and investigated a little bit.

First, using the Kahan exemple, I noticed that determinant calculation (DET function) gives a not so accurate answer:

Kahan matrix: DET=-.999999999998

transposed matrix: DET=-.999999999989

First, why is the determinant of the transposed matrix different?

Second, why is the result non-integer, as all elements are integer and no overflow occurs?

Then I built a simpler exemple, in order to check that the DET function uses internal 15-digit accuracy (this was stated many times, but no clear evidence was given).
I used this matrix:

1+1E-7 1+2E-7

1+3E-7 1+4E-7

If DET uses 15-digits accuracy, result should be -2E-7, otherwise loss of accuracy will occur and result is expected to be 0.

HP-71B Math ROM gives 1.0000003E-14 so it seems that 15-digit accuracy is used
but not only is the value half than expected, but the sign is wrong.

Transposing the matrix gives DET= 2.0000004E-14. Sign is still wrong.

Can we call this a bug? I don't know, but I checked that all next models starting from the HP-28S give correct DET value, so algorihms were changed at some point.



Sorry, my test matrix was not correctly reproduced in this post (a bug?):

| 1.0000001 1.0000002

| 1.0000003 1.0000004

I hope it's OK now.



As to why the results are non-integer and the transposed matrix has a 'different' result:
The numerical operations in the algorithm used (some variant of LU-decomposition followed by the multiplication of the elements on the diagonal) are exposed to roundoff errors, of course. The operations are different in the
transposed matrix - that's why the roundoff errors are
different, too.
As regards the 'internal 15-digit accuracy'. That only
holds for single operations and dot products (that can be
accumulated without extra storage). The numbers themselves are still stored in 12-digit format. The reason the 71B gets the determinant wrong, and the 28S gets it right is probably (guessing): the determinant of 2-by-2 matrices is calculated using the definition, in full 15-digit accuracy (28S).
From the 48G onwards, a check for integer elements has been added - if all elements are integer, then so is the determinant, and the computed value is rounded off to the nearest integer. Also, the matrix is stored in full 15-digit form, reducing roundoff errors.
BTW the determinant for the sample matrix you show is of course -2e-14.

Cheers, Werner


My guess does seem to be correct:
If I try your original matrix on a 42S and a 48SX,
they return the correct answer, but if I try the equivalent
3-by-3 matrix

1.0000000 0.0000000 0.0000000
0.0000000 1.0000001 1.0000002
0.0000000 1.0000003 1.0000004

Then the result is (in both cases) 1.0000003e-14, the result
the 71B gave. And yes, the transpose's determinant is
2.0000004e-14. I'm pretty sure I can find out the exact
order of 15-digit arithmetic operations and 12-digit rounded
stores to come up with these answers. Valentin will probably post it in the next 2 minutes ;-)

Cheers, Werner


Thanks Werner, I fill better: the HP-71B Math ROM is OK, just the HP28/HP48 added some filtering against the most visible rounding effects.


Possibly Related Threads...
Thread Author Replies Views Last Post
  Need help understanding math.... cyrille de Brébisson 9 839 12-13-2013, 02:23 AM
Last Post: Didier Lachieze
  Strange HP 25 Problem (Repair) Onur Ilkorur 5 631 12-06-2013, 05:13 PM
Last Post: Onur Ilkorur
  AFTER HP-Prime update, Shift+Matrix CRASHES Joseph Ec 3 507 12-06-2013, 11:06 AM
Last Post: Joseph Ec
  Strange Battery Icon during updaate of Prime Firmware. Harold A Climer 7 864 12-05-2013, 04:40 PM
Last Post: Michael de Estrada
  HP Prime Matrix TERRIBLE bug and question uklo 19 1,426 11-25-2013, 12:10 PM
Last Post: Mic
  HP Prime: editing a matrix Alberto Candel 6 540 11-20-2013, 06:26 PM
Last Post: Helge Gabert
  Absolute Value and Matrix BruceTTT 5 547 11-11-2013, 11:52 PM
Last Post: Walter B
  HP PRIME : strange behavior when trying user key capability Damien 12 1,021 11-03-2013, 11:02 AM
Last Post: Joe Horn
  hp prime - sending program results to the stack giancarlo 6 627 10-15-2013, 02:00 AM
Last Post: Giancarlo
  HP Prime complex results Javier Goizueta 0 247 10-06-2013, 12:59 PM
Last Post: Javier Goizueta

Forum Jump: