MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

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




  • Prev by Date: Re: About using hyperlinks in notebook, couple of questions
  • Next by Date: Re: How to format Superscript and Subscript for a symbol to the same vertical level??
  • Previous by thread: Re: ReplaceAll and rules from a list v7.0
  • Next by thread: Re: ReplaceAll and rules from a list v7.0