how to collapse lists of vectors ?

Hi,

this is most likely a total noob question, but i cannot find a solution :confused:

i have a list of vectors
{{a,b,c}, {d,e,f}, {g,h,i}}

and i want to add all of these vector so it yields
{a+d+g, b+e+h, c+f+i}

what would be the appropriate function to do so in mathematica ?

thanks

Hint: Look up the Apply function in the help system and experiment with that.

Apply[Plus, {{a, b, c}, {d, e, f}, {g, h, i}}]

same as

Plus @@ {{a, b, c}, {d, e, f}, {g, h, i}}

There are always many ways to do things in Mathematica…

MapThread[Plus, {{a, b, c}, {d, e, f}, {g, h, i}}]
Plus @@@ Transpose[{{a, b, c}, {d, e, f}, {g, h, i}}]

Oops, gave away the answer to the suggestion… :wink:

ah cool, that’s it. thank you very much. :slight_smile: