MathGroup Archive 2007

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

Search the Archive

Re: Mapping a pure function with 2 conponents.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77247] Re: Mapping a pure function with 2 conponents.
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Wed, 6 Jun 2007 06:54:41 -0400 (EDT)
  • References: <f43i20$3hl$1@smc.vnet.net>

Trying one of the followings...

In[209]:=
o = {{0, 1}, {2, 3}, {4, 5}}
Apply[Plus[#1^2 + #2] & , o, {1}]
(Plus[#1[[1]]^2 + #1[[2]]] & ) /@ o
o /. {(x_)?NumberQ, (y_)?NumberQ} -> x^2 + y
MapThread[#1^2 + #2 & , Transpose[o]]

Out[209]=
{{0, 1}, {2, 3}, {4, 5}}

Out[210]=
{1, 7, 21}

Out[211]=
{1, 7, 21}

Out[212]=
{1, 7, 21}

Out[213]=
{1, 7, 21}

Dimitris

phoenix7... at gmail.com       :
> I'm trying to get the following code to work:
>
> Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}]
>
> The goal is to use a pure function in order to achieve the result:
> {1, 7, 21}
>
> The issue is that the evaluation involves   #1^2 + #2 & [{0,1}]
> instead of #1^2 + #2 & [0,1]
>
> Thanks, in advance.



  • Prev by Date: Re: Mapping a pure function with 2 conponents.
  • Next by Date: Re: Mapping a pure function with 2 conponents.
  • Previous by thread: Re: Mapping a pure function with 2 conponents.
  • Next by thread: Re: Mapping a pure function with 2 conponents.