(42S) Column Sums of a Matrix
07-10-2016, 01:36 AM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,131 Joined: Dec 2013
(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]
 « Next Oldest | Next Newest »

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