Math: How to sum each row of a matrix

Posted by macek on Stack Overflow See other posts from Stack Overflow or by macek
Published on 2010-04-18T20:03:38Z Indexed on 2010/04/18 20:23 UTC
Read the original article Hit count: 374

Filed under:
|
|

I have a 1x8 matrix of students where each student is a 4x1 matrix of scores.

Something like:

      SCORES
S [62, 91, 74, 14]
T [59, 7 , 59, 21]
U [44, 9 , 69, 6 ]
D [4 , 32, 28, 53]
E [78, 99, 53, 83]
N [48, 86, 89, 60]
T [56, 71, 15, 80]
S [47, 67, 79, 40]

Main question:

Using sigma notation, or some other mathematical function, how can I get a 1x8 matrix where each student's scores are summed?

# expected result
  TOTAL OF SCORES
S [241]
T [146]
U [128]
D [117]
E [313]
N [283]
T [222]
S [233]

Sub question.

To get the average, I will multiply the matrix by 1/4. Would there be a quicker way to get the final result?

   AVERAGE SCORE
S [60.25]
T [36.50]
U [32.00]
D [29.25]
E [78.25]
N [70.75]
T [55.50]
S [58.25]

Note:

I'm not looking for programming-related algorithms here. I want to know if it is possible to represent this with pure mathematical functions alone.

© Stack Overflow or respective owner

Related posts about math

Related posts about sum