Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'How to Add Pairs of Numbers in a List' topicStudent Support Forum > General > Archives > "How to Add Pairs of Numbers in a List"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
01/20/13 8:06pm

If you have a list of things and you want to perform the same function on each thing in your list then the Map[] function is usually a good choice.

Each of your things is a list and you want the total of that. The Total[] function looks like what you want.

So the result is

In[1]:= data={{1,6},{2,3},{4,5}};Map[Total,data]

Out[2]= {7,5,9}

Read the help pages for Map[] and Total[] and see if you can make sense of those now that you have seen an example.

Substitute your own for data and see if it works

URL: ,

Subject (listing for 'How to Add Pairs of Numbers in a List')
Author Date Posted
How to Add Pairs of Numbers in a List Jen 01/20/13 4:41pm
Re: How to Add Pairs of Numbers in a List Bill Simpson 01/20/13 8:06pm
Re: Re: How to Add Pairs of Numbers in a List Jen 01/20/13 9:31pm
Re: Re: How to Add Pairs of Numbers in a List yehuda 01/21/13 00:30am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic