Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg74529] Re: [mg74478] Applying a list of functions to a single number
  • From: "Adriano Pascoletti" <pascolet at dimi.uniud.it>
  • Date: Sat, 24 Mar 2007 05:20:40 -0500 (EST)

Wrap it with Through:

In[1]:=Through[{Square, Cube}[5]]

Out[1]={25, 125}

Adriano Pascoletti

On 3/24/07, siewsk at bp.com <siewsk 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?
>
>
>


  • Prev by Date: Re: Re: Re: fastest way to add up a billion numbers
  • Next by Date: Re: Applying a list of functions to a single number
  • Previous by thread: Applying a list of functions to a single number
  • Next by thread: Re: Applying a list of functions to a single number