HP-15C Owner's Handbook - Pages 177-179, function tests

Description

GSB 0 runs whole program.
GSB 1 to 9 allows separate subroutines to be repeated for testing.

Testsf MATRIX 0 to f MATRIX 9 functions.
Scalar operations 2 x, 1 -, 2 + and 10 ÷.
Matrix multiplication and division.

Results:
[A] is the intitial matrix containing random numbers in the range from 0 to 20.
[B] contains the result of the scalar operations, above, on [A].
[C] contains the LU from RCL MATRIX C, f MATRIX 9 on [C]. Running GSB 5 after GSB 0, [C] now contains the result from f MATRIX 5.
[D] contains the result from [A]x[B].
[E] contains the result from [A]÷[A], which should be the identity matrix.

To read matrix [A] elements again, press GSB A.
To read matrix [B] elements again, press GSB B.
To read matrix [C] elements again, press GSB C.
To read matrix [D] elements again, press GSB D.
To read matrix [E] elements again, press GSB E.

R7 contains the result from f MATRIX 7 on [B].
R8 contains the result from f MATRIX 8 on [B].
R9 contains the result from f MATRIX 9 on [C].

Subroutines 1 to 9 can be run, some independently, to troubleshoot particular issues.

Matrix [A] should be square and the number of rows even. f MATRIX 2 and f MATRIX 3 will produce error 11 if the number of rows is odd.

USER mode during programming allows indexed STO and RCL of matrix elements. Thef MATRIX 0 statement is also essential.
Once the STO and RCL loops reach the dimensioned size of the matrix the GOTO statement is skipped and the next part of the program runs.

John Patterson
jepattersonatactrix.co.nz
http://www.jepspectro.com

Program Resources

Labels

Name Description Name Description Name Description
 A Read elements in [A]  2 GSB 2 Dimension [A], enter random elements into [A]  9 GSB 9 [C] f MATRIX 9, LU in [C] result stored in R9
 B Read elements in [B]  3 GSB 3 f MATRIX 2, 3, 4, 4 operations on [A] which is unchanged .1 RCL elements from [A] loop
 C Read elements in [C]  4 GSB 4 ((( [A]x2)-1)+2)/10 = [B] Scalar operations .2 RCL elements from [B] loop
 D Read elements in [D]  5 GSB 5 f MATRIX 5 operation on [A], [B] to create [C] .3 RCL elements from [C] loop
 E Read elements in [E]  6 GSB 6 Matrix multiplication [A]x[B] = [D] .4 RCL elements from [D] loop
 0 GSB 0 run program  7 GSB 7 [A] Matrix division [A]/[A] = Identity matrix in [E] .5 RCL elements from [E] loop
 1 CF8, Initialise matrices, enter default 4x4 matrix [A] dimensions  8 GSB 8 [B] f MATRIX 7, f MATRIX 8 results stored in R7 and R8 .6 Load random elements into [A] loop

Storage Registers

Name Description
 7 Contains the result from f MATRIX 7 on [B]
 8 Contains the result from f MATRIX 8 on [B]
 9 Contains the result from f MATRIX 9 on [C]

Flags

Number Description
8 gCF8 Clear complex number flag

Program

Line Display Key Sequence Line Display Key Sequence Line Display Key Sequence
000 046 45;16;11 RCL MATRIX A 092 44 7 STO 7
001 42;21; 0 f LBL 0 047 42;26;12 f RESULT B 093 42 31 f PSE
002 32 1 GSB 1 048 2 2 094 45;16;12 RCL MATRIX B
003 32 2 GSB 2 049 20 × 095 42 31 f PSE
004 32 3 GSB 3 050 1 1 096 42;16; 8 f MATRIX 8
005 32 4 GSB 4 051 30 097 44 8 STO 8
006 32 5 GSB 5 052 2 2 098 42 31 f PSE
007 32 6 GSB 6 053 40 + 099 43 32 g RTN
008 32 7 GSB 7 054 1 1 100 42;21; 9 f LBL 9
009 32 8 GSB 8 055 0 0 101 45;16;13 RCL MATRIX C
010 32 9 GSB 9 056 10 ÷ 102 42 31 f PSE
011 43 32 g RTN 057 45;16;12 RCL MATRIX B 103 42;26;13 f RESULT C
012 42;21; 1 f LBL 1 058 32 12 GSB B 104 42;16; 9 f MATRIX 9
013 43; 5; 8 g CF 8 059 42 31 f PSE 105 44 9 STO 9
014 42;16; 0 f MATRIX 0 060 43 32 g RTN 106 43 32 g RTN
015 4 4 061 42;21; 5 f LBL 5 107 42;21;11 f LBL A
016 42 31 f PSE 062 45;16;11 RCL MATRIX A 108 42;16; 1 f MATRIX 1
017 36 ENTER 063 45;16;12 RCL MATRIX B 109 42;21; .1 f LBL . 1
018 4 4 064 42;26;13 f RESULT C 110 u 45 11 USER RCL A
019 43 32 g RTN 065 42;16; 5 f MATRIX 5 111 22 .1 GTO . 1
020 42;21; 2 f LBL 2 066 45;16;13 RCL MATRIX C 112 43 32 g RTN
021 42;23;11 f DIM A 067 32 13 GSB C 113 42;21;12 f LBL B
022 42;16; 1 f MATRIX 1 068 42 31 f PSE 114 42;16; 1 f MATRIX 1
023 45;16;11 RCL MATRIX A 069 43 32 g RTN 115 42;21; .2 f LBL . 2
024 42;21; .6 f LBL . 6 070 42;21; 6 f LBL 6 116 u 45 12 USER RCL B
025 42 36 f RAN # 071 45;16;11 RCL MATRIX A 117 22 .2 GTO . 2
026 2 2 072 45;16;12 RCL MATRIX B 118 43 32 g RTN
027 0 0 073 42;26;14 f RESULT D 119 42;21;13 f LBL C
028 20 × 074 20 × 120 42;16; 1 f MATRIX 1
029 u 44 11 USER STO A 075 45;16;14 RCL MATRIX D 121 42;21; .3 f LBL . 3
030 22 .6 GTO . 6 076 32 14 GSB D 122 u 45 13 USER RCL C
031 42 31 f PSE 077 42 31 f PSE 123 22 .3 GTO . 3
032 43 32 g RTN 078 43 32 g RTN 124 43 32 g RTN
033 42;21; 3 f LBL 3 079 42;21; 7 f LBL 7 125 42;21;14 f LBL D
034 45;16;11 RCL MATRIX A 080 45;16;11 RCL MATRIX A 126 42;16; 1 f MATRIX 1
035 42 31 f PSE 081 45;16;11 RCL MATRIX A 127 42;21; .4 f LBL . 4
036 42;16; 2 f MATRIX 2 082 42;26;15 f RESULT E 128 u 45 14 USER RCL D
037 42 31 f PSE 083 10 ÷ 129 22 .4 GTO . 4
038 42;16; 3 f MATRIX 3 084 45;16;15 RCL MATRIX E 130 43 32 g RTN
039 42 31 f PSE 085 32 15 GSB E 131 42;21;15 f LBL E
040 42;16; 4 f MATRIX 4 086 42 31 f PSE 132 42;16; 1 f MATRIX 1
041 42 31 f PSE 087 43 32 g RTN 133 42;21; .5 f LBL . 5
042 42;16; 4 f MATRIX 4 088 42;21; 8 f LBL 8 134 u 45 15 USER RCL E
043 42 31 f PSE 089 45;16;12 RCL MATRIX B 135 22 .5 GTO . 5
044 43 32 g RTN 090 42 31 f PSE 136 43 32 g RTN
045 42;21; 4 f LBL 4 091 42;16; 7 f MATRIX 7