# How to accumulate in different lists in same position?

i use Mathematica 9.0 and I want to know, how to accumulate more lists, in the same position ... First of all u have to know, that i can have 1000 lists with 100 elements... for example.

{{1,2,3,4},{1,5,2,3}}...

Now i want to plus all first elements and the 3rd... so i have a new list with

{2,5}

or all 3rd and 4th elements:

{5,7}... at the end i need to subtract all result with 100... so i have for the first example ... so this can be a big combination... all first and 4th oder 2nd and 3rd oder first and 4th ... an so on

{{2,5},{98,95}}... At the end i create a 2x2 matrix and calculate the sums of rows and list... so this is very easy but if u have 1000 lists with 100 elements, it will be a little harder...

i hope u can help me

list = {{1, 2, 3, 4}, {1, 5, 2, 3}};

Total @ list[[All, {1, 3}]]


{2, 5}

For multiple totals you can do

Total @ list[[All, #]] & /@ {{1, 3}, {1, 4}}


{{2, 5}, {2, 7}}

{#, 100 - #} &[Total@list[[All, {1, 3}]]]

• Also: Total[list[[All, {1, 3}]], {1}]. Aug 21, 2017 at 16:10