MathGroup Archive 2007

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

Search the Archive

Re: Applying a list of functions to a single number

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74523] Re: Applying a list of functions to a single number
  • From: "Raj" <rajanikanth at gmail.com>
  • Date: Sat, 24 Mar 2007 05:17:20 -0500 (EST)
  • References: <eu1peu$eu1$1@smc.vnet.net>

On Mar 23, 4:56 pm, sie... at bp.com wrote:
> Applying a list of functions to a single number
> =================================
>
> I have
>
> Square[x_]:=x^2
> Cube[x_]:=x^3
>
> I have tried
>
> In[2]:={Square,Cube} @ 5
>
> Out[2]:= {Square,Cube}[5]
>
> But what I wanted is a list containing
>
>  {25,125}
>
> Obviously I'm doing this the wrong way. What is the correct way?

Here are some of the correct ways

{#^2,#^3}&[5]

 {Square[#],Cube[#]}&[5]

Cheers,

Raj



  • Prev by Date: Re: Applying a list of functions to a single number
  • Next by Date: Re: simplifications
  • Previous by thread: Re: Applying a list of functions to a single number
  • Next by thread: Re: Applying a list of functions to a single number