Matrix Example test 0, Function test

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] contains [A] which 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.

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