MathGroup Archive 2009

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

Search the Archive

Re: ReplaceAll and rules from a list v7.0


kristoph wrote:

> 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
>

I'm not sure, if I understand correctly what you want to do.
If you want to add the elements of the sublists of l, then try

Plus @@@ l

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: How to print/display symbolic expressions from inside a Module
  • Next by Date: Re: Re: which values of m satisfies the inequality
  • Previous by thread: Re: ReplaceAll and rules from a list v7.0
  • Next by thread: Re: ReplaceAll and rules from a list v7.0