matrix Inverse using Hp-17BII+



#2

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.

L11=A11
L21=A21
L31=A31
U12=A12 / L11
U13=A13 / L11
L22=A22 - L21.U12
U23=(A23 - L21.U13) / L22
L32=A32-L31.U12
L33=A33 - L31.U13 - L32.U23
Y1=1 / L11
Y2=-L21.Y1 / L22
Y3=(-L31.Y1 - L32.Y2) / L33
V31=Y3
V21=Y2 - U23.V31
V11=Y1 - V21.U12 - U13.V31
Y1=0
Y2=1 / L22
Y3=-L32.Y2 / L33
V32=Y3
V22=Y2 - U23.V32
V12=Y1 - U12.V22 - U13.V32
Y1=0
Y2=0
Y3=1 / L33
V33=Y3
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

AINV=0x(L(l11:ITEM(A:1)) 
+L(L21:ITEM(A:4))
+L(L31:ITEM(A:7))
+L(U12:ITEM(A:2)/G(11))
+L(U13:ITEM(A:3)+G(L11))
+L(L22:ITEM(A:5)-G(L21)xG(U12))
+L(U23:ITEM(A:6)- G(L21)xG(U13))/G(L22))
+L(L32:ITEM(A:8)-G(L31)xG(U12))
+L(L33:ITEM(A:9)-G(L31)xG(U13)-G(L32)xG(U23))
+L(Y1:1/G(L11))
+L(Y2:-G(L21)xG(Y1)/G(L22))
+L(V31:(-G(L31)xG(Y1)-G(L32)xG(Y2)/G(L33))
+L(V21:G(Y2)-G(U23)xG(V31))
+L(V11:G(Y1)-G(V21)xG(U12)-G(V31)xG(U13))
+L(Y2:1/G(L22))
+L(V32:-G(L32)xG(Y2)/G(L33))
+L(V22:G(Y2)-G(U23)xG(V32))
+L(V12:-G(U12)xG(V22)-G(U13)xG(V32))
+L(V33:1/G(L33))
+L(V23:-G(U23)xG(V33))
+L(V13:-G(U12)xG(V23)-G(U13)xG(V33)))

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.


Possibly Related Threads...
Thread Author Replies Views Last Post
  AFTER HP-Prime update, Shift+Matrix CRASHES Joseph Ec 3 232 12-06-2013, 11:06 AM
Last Post: Joseph Ec
  Solver issue with HP 17BII - different from 19BII Jeff Kearns 13 467 11-28-2013, 02:36 AM
Last Post: Don Shepherd
  HP Prime Matrix TERRIBLE bug and question uklo 19 793 11-25-2013, 12:10 PM
Last Post: Mic
  17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 392 11-25-2013, 10:28 AM
Last Post: Don Shepherd
  HP Prime: editing a matrix Alberto Candel 6 270 11-20-2013, 06:26 PM
Last Post: Helge Gabert
  Absolute Value and Matrix BruceTTT 5 297 11-11-2013, 11:52 PM
Last Post: Walter B
  Is the Prime a superset of the HP 17bII+ ? vrrr 3 210 10-16-2013, 12:03 PM
Last Post: Michael de Estrada
  WP-34S Matrix operations with routine-local registers? Tom Grydeland 1 155 09-04-2013, 10:46 AM
Last Post: Marcus von Cube, Germany
  Matrix Characteristic Polynomial - Reloaded. Ángel Martin 12 447 08-22-2013, 05:33 PM
Last Post: Thomas Klemm
  Matrix Richard Berler 3 192 08-18-2013, 06:24 PM
Last Post: Paul Dale

Forum Jump: