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: [mg77262] Re: [mg77213] Mapping a pure function with 2 conponents.
  • From: János <janos.lobb at yale.edu>
  • Date: Wed, 6 Jun 2007 07:02:29 -0400 (EDT)
  • References: <200706051102.HAA02102@smc.vnet.net>

On Jun 5, 2007, at 7:02 AM, phoenix7744 at gmail.com wrote:

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

Here is a newbie approach:

In[3]:=
(#1[[1]]^2 + #1[[2]] & ) /@
   {{0, 1}, {2, 3}, {4, 5}}
Out[3]=
{1, 7, 21}

J=E1nos


---------------------------------------------
"Its like giving a glass of ice water to somebody in Hell"
Steve Jobs about iTunes on Windows




  • Prev by Date: Re: Mapping a pure function with 2 conponents.
  • Next by Date: Re: Slow work of some List functions in Mathematica 6
  • Previous by thread: Mapping a pure function with 2 conponents.
  • Next by thread: Re: Mapping a pure function with 2 conponents.