Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of n vectors with an even length. Let us make an easy example with 3 vectors of length=4:


I want to create the vectors:




I suppose I have to use GatherBy, but I have not found the way to get what I want.

share|improve this question
Have a look at Partition. – b.gatessucks Feb 26 '13 at 15:58
This is the latest of many questions you have asked that are all incorrectly tagged [sparse-arrays]. Please ensure that you use tags that are relevant to the topic of your question. – Oleksandr R. Feb 26 '13 at 16:20
up vote 2 down vote accepted
a = {a1, a2, a3, a4}; b = {b1, b2, b3, b4}; c = {c1, c2, c3, c4}; 
{d1, d2, e1, e2, f1, f2} = Partition[Join[a, b, c], 2]


{{d1, d2}, {e1, e2}, {f1, f2}} = Partition[#, 2] & /@ {a, b, c}
share|improve this answer
You beat me by seconds! +1, I respectfully withdrawal – Jagra Feb 26 '13 at 16:19
Actually wouldn't this prove more general for even lengthed lists: {{d1, d2}, {e1, e2}, {f1, f2}} = Partition[#, Length[#]/2] & /@ {a, b, c}; – Jagra Feb 26 '13 at 16:21
@Jagra The question could be "generalized" in every direction you may think of :) . I really dislike naming sublists like that, no need. – Dr. belisarius Feb 26 '13 at 16:42

Your Answer


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.