RE: ReplaceAll and rules from a list v7.0
- To: mathgroup at smc.vnet.net
- Subject: [mg104271] RE: [mg104227] ReplaceAll and rules from a list v7.0
- From: "David Park" <djmpark at comcast.net>
- Date: Sun, 25 Oct 2009 01:09:58 -0400 (EDT)
- References: <21648869.1256367070497.JavaMail.root@n11>
I don't see why you are trying to do this with an equation and ReplaceAll
instead of a function. Just Map Total onto the list.
list = {{1, 1}, {2, 2}, {3, 3}};
Total /@ list
{2, 4, 6}
Or you could design your own particular function for combining a and b.
add[{a_, b_}] := a + b
add /@ list
{2, 4, 6}
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: kristoph [mailto:kristophs.post at web.de]
Hi,
Suppose I have the equation
x=a+b
and the list
l={{1,1},{2,2},{3,3}}
How can I quickly assign the list to the above equation, that is, I
would like to get the following result
{2,4,6}
The first element of each sub-list should be assigned to a and the
second to b.
Thanks in advance.
Kristoph