Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sum a list of vectors

I'm given a list of rational vectors, i.e., something like [(1,2,3), (1/2, 4, 5), (-1, 0, 0)], and I need to sum all vectors of this list.

Even though I searched a bit, I cannot find the right sage command for this task. For example, sum() does not seem to work here. At least I couldn't figure out how to apply it to a list of such type.

Of course I could use a loop and an additional variable that saves the partial sums. But there has to be a more elegant way.