Re: ReplaceAll and rules from a list v7.0
- To: mathgroup at smc.vnet.net
- Subject: [mg104264] Re: ReplaceAll and rules from a list v7.0
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 25 Oct 2009 01:08:39 -0400 (EDT)
On 10/24/09 at 2:40 AM, kristophs.post at web.de (kristoph) wrote:
>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.
In[6]:= x = a + b;
l = {{1, 1}, {2, 2}, {3, 3}};
x /. Thread[{a, b} -> #] & /@ l
Out[8]= {2,4,6}