(15C) Sums of five lists - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (15C) Sums of five lists (/thread-15086.html) |
(15C) Sums of five lists - Dave Britten - 05-28-2020 10:57 PM 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 |