Post Reply 
(42S) Column Sums of a Matrix
07-10-2016, 01:36 AM
Post: #1
(42S) Column Sums of a Matrix
HP 42S: Column Sums of a Matrix

This could potentially had been a medium to long sized programs involving loops, but thanks to the powerful function RSUM (found in CATALOG-FUNC or executed by XEQ RSUM) this program will be quite short. RSUM is the row sum function, or the sum of each row of a matrix.

Just put a matrix on the stack and run CSUM. When the program is finished, press [shift] [ 9 ] (MATRIX), {EDIT} to see the sums.

Code:
00 {12-Byte Prgm}
01 LBL “CSUM”
02 TRANS \\ transpose
03 RSUM
04 END

Test: MAT1 = [ [4, 3, 1], [5, 8, 2], [7, 6, 3]]
Result: [16, 17, 6]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42S) Column Sums of a Matrix - Eddie W. Shore - 07-10-2016 01:36 AM



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