MathGroup Archive 2003

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

Search the Archive

Re: Applying multiple functions to multiple sets of arguements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42648] Re: Applying multiple functions to multiple sets of arguements
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 19 Jul 2003 03:19:32 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <bf8f5g$5ne$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

with
args = {x1, x2, xm};
funs = {f1, f2, fn};

Through /@ Thread[funs [args]]

gives

{{f1[x1], f2[x1], fn[x1]}, {f1[x2], f2[x2], fn[x2]}, {f1[xm], f2[xm],
fn[xm]}}

Regards
  Jens

Rishi Roy wrote:
> 
> Hi all.  I was hoping someone cold help me.  I wanted a way to apply
> an arbitrary number of functions to an arbitrary number of sets of
> arguments.
> 
> Meaning if I have n functions: {f1, f2, ...,fn} and m sets of
> arguments: {x1, x2, ..., xm}, how can I generate a list like:
> {{f1[x1], f1[x2], ...,f1[xm]},{f2[x1], f2[x2],
> ...,f2[xm]},...,{fn[x1], fn[x2], ...,fn[xm]}}?
> 
> I am currently doing this by looping throgh both lists and populating
> each results one by one.  As expecting this is horribly slow.  I was
> hoping someone could recommend a faster, functional way to do this.  I
> tried using map, but couldnt get a handle on it.
> 
> Any help would be greatly appreciated.  Thank you in advance.
> 
> Rishi Roy


  • Prev by Date: Re: Applying multiple functions to multiple sets of arguements
  • Next by Date: Re: problem while loading packages
  • Previous by thread: Re: Applying multiple functions to multiple sets of arguements
  • Next by thread: Re: Applying multiple functions to multiple sets of arguements