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: [mg112947] Re: How to apply a list of functions
  • From: Peter Pein <petsie at dordos.net>
  • Date: Thu, 7 Oct 2010 03:36:52 -0400 (EDT)
  • References: <201010030739.DAA19966@smc.vnet.net>

Am Tue, 5 Oct 2010 09:38:29 +0000 (UTC)
schrieb Sam Takoy <sam.takoy at yahoo.com>:

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

Hi Sam,

If you've got an arbitrarily nested list of names of functions

In[1]:= ftbl = {Log, {{Sin, Cos}, {{Exp}}}};

then pattern matching can be an option:

In[2]:= ftbl /. Except[List, f_Symbol] :> f[x]
Out[2]= {Log[x], {{Sin[x], Cos[x]}, {{E^x}}}}

Peter



  • Prev by Date: Re: More universal way of writing gradient
  • Next by Date: Superscripts in strings change color to gray
  • Previous by thread: Re: How to apply a list of functions
  • Next by thread: Re: How to apply a list of functions