Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg104277] Re: [mg104227] ReplaceAll and rules from a list v7.0
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Sun, 25 Oct 2009 01:11:05 -0400 (EDT)
  • References: <200910240640.CAA07557@smc.vnet.net>

In[1]:= l = {{1, 1}, {2, 2}, {3, 3}};
Apply[Plus, l, {1}]
Out[2]= {2, 4, 6}
In[3]:= l /. {x_, y_} :> x + y
Out[3]= {2, 4, 6}

Adriano Pascoletti

2009/10/24 kristoph <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
>
>


  • Prev by Date: Re: How create vertical line using Plot?
  • Next by Date: Re: How to print/display symbolic expressions from inside a Module
  • Previous by thread: ReplaceAll and rules from a list v7.0
  • Next by thread: Re: ReplaceAll and rules from a list v7.0