tags:

views:

201

answers:

2

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.

+5  A: 

Right multiply the student's score matrix by the column matrix [1, 1, 1, 1] to get the sum and by [1/4,1/4,1/4,1/4] to get the mean.

Guillaume
+1 Very elegant
Onion-Knight
@Guillaume, this is awesome. very elegant.
macek
+1  A: 

Sigma notation? Do you mean summation?

alt text

Jack
Except that you want to sum over the length-4 rows. (And anyway it would be 0...7 for length 8!)
Andrew Jaffe
yep, professional deformation.. 0-based indexes are not used for matrices :)
Jack
by the way it's not length-4, but just 4, since there is no correlation between number of students and number of votes..
Jack
*"0-based indexes are not used for matrices"* except by physicists...
dmckee