RE: ReplaceAll and rules from a list v7.0
- To: mathgroup at smc.vnet.net
- Subject: [mg104255] RE: [mg104227] ReplaceAll and rules from a list v7.0
- From: Richard Hofler <rhofler at bus.ucf.edu>
- Date: Sun, 25 Oct 2009 01:06:58 -0400 (EDT)
- References: <200910240640.CAA07557@smc.vnet.net>
Hi Kristoph, Using Map ( /@) should work. Notice the curly brackets inside square = brackets in f. In[8]:= f[{a_,b_}]:=a+b In[5]:= lst={{1,1},{2,2},{3,3}}; In[9]:= f/@lst <mailto:f/@lst> Out[9]= {2,4,6} I hope this helps. Richard Richard Hofler ________________________________ From: kristoph [mailto:kristophs.post at web.de] Sent: Sat 10/24/2009 2:40 AM To: mathgroup at smc.vnet.net Subject: [mg104255] [mg104227] ReplaceAll and rules from a list v7.0 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
- References:
- ReplaceAll and rules from a list v7.0
- From: kristoph <kristophs.post@web.de>
- ReplaceAll and rules from a list v7.0