The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

matrix Inverse using Hp-17BII+
Message #1 Posted by chris dean on 9 Aug 2005, 8:38 a.m.

The HP 27S and 19B Technical Manual uses the matrix of 
(cofactors / determinant) method to solve Ax=B. I originally
started doing the inversion using LU decomposition to be able 
to invert N*N matrices but soon found that I could not enter 
values into the ITEM() array at run time (i.e. whilst trying 
to solve). Therefore I pursued a solution for a 3*3 matrix 
only, just to say that I had done it!

The underlying equations using LU decomposition are shown below.

U12=A12 / L11
U13=A13 / L11
L22=A22 - L21.U12
U23=(A23 - L21.U13) / L22
L33=A33 - L31.U13 - L32.U23
Y1=1 / L11
Y2=-L21.Y1 / L22
Y3=(-L31.Y1 - L32.Y2) / L33
V21=Y2 - U23.V31
V11=Y1 - V21.U12 - U13.V31
Y2=1 / L22
Y3=-L32.Y2 / L33
V22=Y2 - U23.V32
V12=Y1 - U12.V22 - U13.V32
Y3=1 / L33
V23=Y2 - U23.V33
V13=Y1 - U12.V23 - U13.V33

I had to split the equations into Z for variable registration, 
SUM for the input array A and AINV for calculation otherwise 
the equation seemed to run out memory at run time and did not
calculate the last few terms. 

Z=V11+V12+V13+V21+V22+V23+V31+V32+V33+ L11+L21+L22+L31+L32+L33+U12+U13+U23+ Y1+Y2+Y3

+L(U23:ITEM(A:6)- G(L21)xG(U13))/G(L22))

Use the SUM menu to input the values for the 9 matrix elements where element k = (row-1)*3 + column. Click on NAME and save the data as A.

Go to the solve menu, find the Z formula and click on CALC to register the variables.

Find the AINV formula and click on CALC. Click on AINV, when it is finished the display should show AINV=0.000

Click on EXIT and go to the Z equation. Click on CALC and then RCL V11, RCL V12, RCL . to show all the elements of the inverse matrix of A.

A useful test matrix is the Hilbert matrix 1, , 1/3, , 1/3, , 1/3, , 1/5 with the resultant inverse matrix elements 9, -36, 30, -36, 192, -180, 30, -180, 180 ignoring the rounding errors.

I have not studied the accuracy of the results as yet but thought I would post it for any comments and hopefully any improvements on technique. Also are there any tricks that I do not know about that I could have used?

Edited: 9 Aug 2005, 9:07 a.m.

[ Return to Index | Top of Index ]

Go back to the main exhibit hall