HP Forums

Full Version: (42S) Column Sums of a Matrix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
Reference URL's