       Re: How to apply a list of functions

• To: mathgroup at smc.vnet.net
• Subject: [mg112918] Re: How to apply a list of functions
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Wed, 6 Oct 2010 03:14:01 -0400 (EDT)

```Through[#[x]] & /@ {{Sin, Cos}, {Sec, Csc}}

{{Sin[x], Cos[x]}, {Sec[x], Csc[x]}}

Bob Hanlon

---- Sam Takoy <sam.takoy at yahoo.com> wrote:

=============
On 10/3/2010 5:41 AM, Adriano Pascoletti wrote:
> Something like this?
>
> In:= Through[{Sin, Cos}[x]]
> Out= {Sin[x], Cos[x]}
>
>
> In:= Through[{Sin, Cos}[{z1, z2, z3}]]
> Out= {{Sin[z1], Sin[z2], Sin[z3]}, {Cos[z1], Cos[z2], Cos[z3]}}
>
>
>
>
> 2010/10/3 Sam Takoy<sam.takoy 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

```

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