Matrix example 6 - HP15c Owner's Handbook - pages 157-159

Description

GSB 6
Cabbages and broccoli are sold. Total weekly weight, total weekly value and the price per kg of each are known.
The program enters the sales data over 3 weeks and outputs the total weights of each vegetable, for each week, in matrix [D]

Inputs
Cabbage $0.24 per kg
Broccoli $0.86 per kg
Store kg and price in [A], a 2x2 matrix

For weeks 1, 2 and 3:
Total weights 274, 233 and 331 kg
Total value $120.32, $112.96 and $151.36
Store weights and value in [B], a 2x3 matrix (2 rows, 3 columns)

Result
In matrix [D] for weeks 1, 2 and 3, a 2x3 matrix
Weight Cabbage 186, 141 and 215 kg
Weight Broccoli 88, 92 and 116 kg

I added some R/S statements in the program after each set of matrix STO statements. They are ignored as they are immediately after the last data entry where a program statement skip automatically occurs. If you don’t use these redundant statements you will get strange results. USER mode during programming allows indexed STO and RCL of matrix elements. The f MATRIX 0 statement is also essential.

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

Program Resources

Labels

Name Description
 6 GSB 6 to run
.6 Matrix [D] element readout loop

Flags

Number Description
8 CF8 clear complex flag

Program

Line Display Key Sequence Line Display Key Sequence Line Display Key Sequence
000 027 3 3 054 1 1
001 42;21; 6 f LBL 6 028 42;23;12 f DIM B 055 1 1
002 43; 5; 8 g CF 8 029 45;16;12 RCL MATRIX B 056 2 2
003 42;16; 0 f MATRIX 0 030 42;16; 1 f MATRIX 1 057 48 .
004 2 2 031 2 2 058 9 9
005 36 ENTER 032 7 7 059 6 6
006 42;23;11 f DIM A 033 4 4 060 u 44 12 USER STO B
007 45;16;11 RCL MATRIX A 034 u 44 12 USER STO B 061 42 31 f PSE
008 42;16; 1 f MATRIX 1 035 42 31 f PSE 062 1 1
009 1 1 036 2 2 063 5 5
010 u 44 11 USER STO A 037 3 3 064 1 1
011 42 31 f PSE 038 3 3 065 48 .
012 u 44 11 USER STO A 039 u 44 12 USER STO B 066 3 3
013 42 31 f PSE 040 42 31 f PSE 067 6 6
014 48 . 041 3 3 068 u 44 12 USER STO B
015 2 2 042 3 3 069 31 R/S
016 4 4 043 1 1 070 42 31 f PSE
017 u 44 11 USER STO A 044 u 44 12 USER STO B 071 45;16;12 RCL MATRIX B
018 42 31 f PSE 045 42 31 f PSE 072 45;16;11 RCL MATRIX A
019 48 . 046 1 1 073 42;26;14 f RESULT D
020 8 8 047 2 2 074 10 ÷
021 6 6 048 0 0 075 42;21; .6 f LBL . 6
022 u 44 11 USER STO A 049 48 . 076 42 31 f PSE
023 31 R/S 050 3 3 077 u 45 14 USER RCL D
024 42 31 f PSE 051 2 2 078 22 .6 GTO . 6
025 2 2 052 u 44 12 USER STO B 079 43 32 g RTN
026 36 ENTER 053 42 31 f PSE