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.

I have been using mathematica for a while, but I have problem wrapping my head around list manipulation functions. I would appreciate any suggestions. Here is what I want to do.

ListV is a list of vectors:

ListV= {{x1,y1,z1},{x2,y2,z2},...}= {V1,V2,...}

ListU is also a list of vectors :

ListU={{a1,b1,c1},{a2,b2,c2},...}= {U1,U2,...}

ListU and ListV may have unequal lengths.

I want to make a new list (ListUV) which would contain all the new positions generated by the sum of all vectors in ListU and ListV. Mathematically, that would be

ListUV= {V1+U1, V2+U1, ..., V2+U1, V2+U2, ... }.

Thanks for any suggestions.

share|improve this question
Is it what you want? Flatten[Outer[Plus, ListV, ListU], 1] –  Yi Wang Feb 19 '14 at 13:19
You say V2+U1, ... V2+U1, V2+U2. Do you mean V2+U1, ... V3+U1, V3+U2 ? –  Jacob Akkerboom Feb 19 '14 at 14:23
'Partition[Flatten[Outer[Plus, UnitCellPositions, LatticePositions, 1]], 3]' does exactly what I need. Thank you Yi Wang for the solution. –  user3328102 Feb 19 '14 at 16:50
Thank you PlatoManiac for edited the formatting. –  user3328102 Feb 19 '14 at 16:54
@YiWang Please consider posting an answer :) –  Kuba Apr 24 '14 at 17:43

Your Answer


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

Browse other questions tagged or ask your own question.