Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: How to apply a list of functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112916] Re: How to apply a list of functions
  • From: Vince Virgilio <blueschi at gmail.com>
  • Date: Wed, 6 Oct 2010 03:13:40 -0400 (EDT)
  • References: <201010030739.DAA19966@smc.vnet.net> <i89j4i$lqn$1@smc.vnet.net> <i8erml$i4u$1@smc.vnet.net>

On Oct 5, 5:38 am, Sam Takoy <sam.ta... at yahoo.com> wrote:
> On 10/3/2010 5:41 AM, Adriano Pascoletti wrote:
>
>
>
> > Something like this?
>
> > In[3]:= Through[{Sin, Cos}[x]]
> > Out[3]= {Sin[x], Cos[x]}
>
> > In[4]:= Through[{Sin, Cos}[{z1, z2, z3}]]
> > Out[4]= {{Sin[z1], Sin[z2], Sin[z3]}, {Cos[z1], Cos[z2], Cos[z3]}}
>
> > Adriano Pascoletti
>
> > 2010/10/3 Sam Takoy<sam.ta... at yahoo.com>
>
> >> Hi,
>
> >> As a follow up to my question about apply {Sin, Cos} to x, I came up
> >> with the tasteless
>
> >> Map[Apply[#, {x}]&, {Sin, Cos}]
>
> >> but I expect that the pros in this ng will be able to improve upon it.
>
> >> Thanks,
>
> >> Sam
>
> Hi,
>
> Thanks to all who suggested Through.
>
> It works of a List of functions, but doesn't work for a List of a List
> of functions, such as {{Sin}, {Cos}}. Is there a way to make it work?
>
> Thanks!
>
> Sam

Sam,

Force the argument into the same structure as your functions, then use
MapThread at the appropriate level.

Vince


  • Prev by Date: Mathematica crashes
  • Next by Date: Re: How to apply a list of functions
  • Previous by thread: Re: How to apply a list of functions
  • Next by thread: Re: How to apply a list of functions