Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Given a array of lists with the same number of here N = 10 elements:

SuperList = {{5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5.,4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}, {5.1, 5.09667, 5.09335, 5.09002, 5.08669, 5.08337, 5.08004, 5.07671, 5.07338, 5.07006}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 5., 5., 5., 5., 5., 5., 5., 5., 5.}, {5., 4.99667, 4.99335, 4.99002, 4.98669, 4.98337, 4.98004, 4.97671, 4.97338, 4.97006}};

How do I efficiently compute an array, which we'll call "MedianList" of length N where each element in the array is the median or mean of the sublist entries at the same index in the "SuperList"? For example, the first element would be:

MedianList[[1]] = Median[{5., 5., 5., 5., 5.1, 5., 5., 5., 5., 5.}];

The second element would be:

MedianList[[2]] = Median[{4.99667, 4.99667, 4.99667, 4.99667, 5.09667, 5., 5., 5., 5., 4.99667}];

And so forth.

share|improve this question
add comment

1 Answer

Doesn't Median[SuperList] do just that?

From the documentation:

${\text{Median}}\left(\left\{\left\{x_1,y_1,\ldots \right\},\left\{x_2,y_2,\ldots \right\},\ldots \right\}\right) \text{ gives } \left\{\text{Median}\left[\left\{x_1,x_2,\ldots \right\}\right],\text{Median}\left[\left\{y_1,y_2,\ldots \right\}\right]\right\} \text{. }$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.