(15C) Sums of five lists
05-28-2020, 10:57 PM
Post: #1
 Dave Britten Senior Member Posts: 2,294 Joined: Dec 2013
(15C) Sums of five lists
This program lets you quickly accumulate and sum five separate lists/columns of numbers by using the five matrices. In addition to the matrices, the program occupies 11 registers and only uses storage registers 0, 1, and I, so it can be run with DIM (i)=0 to store up to 54 list items across the five lists.

Usage

Press f MATRIX 0 to clear all data.

To append an item to list A, B, C, D, or E, enter the number into x and press f A, f B, f C, f D, or f E respectively. (Alternatively, enable USER mode with f USER, and press A, B, C, D, or E directly.)

If flag 1 is clear (f CF 1), the matrix descriptor for the list that the number was appended to will be left in x, showing the name of the matrix and the new count of items.

If flag 1 is set (f SF 1), the list's matrix descriptor will be displayed briefly, and then the new total returned in x. (This option increases the processing time for adding an item to the list, as the sum has to be recalculated on each new entry.)

To calculate the sum of the list whose matrix descriptor is in x, press GSB 9.

To calculate the sums of all lists in sequence, press GSB 1. The program will briefly display the first list's matrix descriptor, followed by the sum of that list. Press R/S to show the next list. Empty lists, or lists with a sum of 0 will be skipped.

Example

Calculate the sums of two lists:

List 1: 250, 150, 525, 275, 300
List 2: 10, 10, 2, 100, 10

(User input shown in bold, displayed results in normal font.)

f MATRIX 0
g CF 1
f USER
(if USER mode is not already enabled)
250 A
A 1 1
150 A
A 2 1
525 A
A 3 1
275 A
A 4 1
300 A
A 5 1
10 B
b 1 1
10 B
b 2 1
2 B
b 3 1
100 B
b 4 1
10 B
b 5 1
GSB 1
A 5 1 (briefly)
1,500.0000
R/S
b 5 1 (briefly)
132.0000
R/S
0.0000 (listing is finished)

Note that items may be added to the lists in any order, i.e. you aren't required to first fill list A, then B, etc. as is done in the example.

Code:
001  42,21,11   LBL A 002  45,16,11   RCL MATRIX A 003  22 0       GTO 0 004  42,21,12   LBL B 005  45,16,12   RCL MATRIX B 006  22 0       GTO 0 007  42,21,13   LBL C 008  45,16,13   RCL MATRIX C 009  22 0       GTO 0 010  42,21,14   LBL D 011  45,16,14   RCL MATRIX D 012  22 0       GTO 0 013  42,21,15   LBL E 014  45,16,15   RCL MATRIX E 015  42,21,0    LBL 0 016  44 25      STO I 017  33         RDown 018  45,23,25   RCL DIM I 019  43 20      x=0 020  13         10^x 021  34         x><y 022  1          1 023  40         + 024  34         x><y 025  42,23,25   DIM I 026  44,43,24   STO g (i) 027  33         RDown 028  33         RDown 029  45 25      RCL I 030  43,6,1     F? 1 031  22 2       GTO 2 032  43 32      RTN 033  42,21,9    LBL 9 034  44 25      STO I 035  45,23,25   RCL DIM I 036  33         RDown 037  43 20      x=0 038  43 32      RTN 039  33         RDown 040  42,16,1    MATRIX 1 041  0          0 042  36         ENTER 043  42,21,8    LBL 8 044  40         + 045  u 45 24    USER RCL (i) 046  22 8       GTO 8 047  40         + 048  43 32      RTN 049  42,21,1    LBL 1 050  45,16,11   RCL MATRIX A 051  32 2       GSB 2 052  45,16,12   RCL MATRIX B 053  32 2       GSB 2 054  45,16,13   RCL MATRIX C 055  32 2       GSB 2 056  45,16,14   RCL MATRIX D 057  32 2       GSB 2 058  45,16,15   RCL MATRIX E 059  32 2       GSB 2 060  43 35      CLx 061  43 32      RTN 062  42,21,2    LBL 2 063  32 9       GSB 9 064  43 20      x=0 065  43 32      RTN 066  34         x><y 067  42 31      PSE 068  34         x><y 069  31         R/S 070  43 32      RTN
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)