Re: HP15C vs. HP42S functionality Message #19 Posted by Karl Schneider on 3 Sept 2006, 11:49 p.m., in response to message #15 by Valentin Albillo
Hi, Valentin 
Quote:
It's not so much a memory issue as a precision issue. In the HP15C, the whole RYX computation is carried out in a single, microcoded instruction, internally using extended precision with 13digit mantissas. Unless this computation is done at that precision and no less, the result would be useless.
Doing the same operations on the stack will not give the correct result, because this instruction is typically used to compute residuals, i.e., the result matrix has very small elements throughout.
Statements in the HP15C Owner's Handbook and Advanced Functions Handbook are consistent with what you stated:
OH, p. 159: "Using MATRIX 6 rather than * and  gives a result with improved accuracy, particularly if the residual is small compared with the matrices being subtracted."
AFH, p. 104: "In order for F + Z to be a better approximation to X than is Z, the residual R = B  AZ must be calculated to extended precision. The HP15C's MATRIX 6 does this. (NOTE: X is the actual solution to AX = B; Z is the estimated solution; and F is the estimated error of Z from X.)
However, I worked through the example on pp. 119121 of the AFH, which uses an iteration with residual to improve the calculation of the inverse of
A = [ 33 16 72]
[24 10 57]
[ 8 4 17]
by linear solution for Z of AZ = I.
The determinant of A is exactly 6, which the HP15C calculates as 5.999999867  not nearsingular by any means. The matrix is also not illconditioned, with a condition number of about 5364.
Using and modifying the program on page 120 of the AFH, I found that calculating the residual R = B  AZ using MATRIX 6 and by manual methods made not one iota of identifiable difference in the calculated residual or in the adjusted solution.
Assuming that matrix multiplication is performed at extended precision (perhaps not so; I haven't found any confirmation), the only computational difference between MATRIX 6 and manual methods would be that the subtraction B  AZ would be computed using 13 significant digits by MATRIX 6, and with 10 significant digits manually. Either way, B has only 10 digits, and the resulting residual R is rounded to 10 significant digits.
I suspect that for most "typical" applications, the additional accuracy of MATRIX 6 is either insignificant or possibly unwarranted. Difficult matrices may be quite another matter...
Still, MATRIX 6 is a valuable builtin function on the HP15C. In addition to the added computational robustness where necessary, it's more convenient and usable. The manual alternative to obtaining R = B  AC would have been
RCL MATRIX B
STO MATRIX D
RCL MATRIX D
RCL MATRIX A
RCL MATRIX C
RESULT D
*

which requires the user to place three matrix descriptors on the stack in the correct order, and also to specify a suitable unique RESULT matrix that takes extra space. (If A, B, and C were each 4x4, all 64 free registers would be required!)
Should the HP42S have had a builtin "residual" operation? Maybe so, but there's less justification for it  plenty of space to load input matrices, no RESULT matrix to get wrong, and the extra accuracy might not be usually necessary. Furthermore, with 12digit arguments, the results are more accurate to begin with.
Best regards,
 KS
Edited: 4 Sept 2006, 1:11 a.m.
