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: [mg77334] Re: [mg77213] Mapping a pure function with 2 conponents.
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 7 Jun 2007 03:39:28 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

There is a single argument with two parts.

Map[#[[1]]^2 + #[[2]] &, {{0, 1}, {2, 3}, {4, 5}}]

{1,7,21}


Bob Hanlon

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



  • Prev by Date: Re: question
  • Next by Date: Re: NDSolve, Do loop, and Plot
  • Previous by thread: Re: Mapping a pure function with 2 conponents.
  • Next by thread: Re: Mapping a pure function with 2 conponents.