Re: Applying a list of functions to a list of arguments
- To: mathgroup at smc.vnet.net
- Subject: [mg57334] Re: [mg57309] Applying a list of functions to a list of arguments
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 25 May 2005 06:02:38 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
f={f1,f2,f3};
a={a1,a2,a3};
Inner[#1[#2]&, f, a, List]
{f1[a1], f2[a2], f3[a3]}
#[[1]][#[[2]]]&/@Thread[{f,a}]
{f1[a1], f2[a2], f3[a3]}
Bob Hanlon
>
> From: D M Yates <yatesd at mac.com>
To: mathgroup at smc.vnet.net
> Date: 2005/05/24 Tue AM 05:12:47 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg57334] [mg57309] Applying a list of functions to a list of arguments
>
> I have a list of functions, and a list of arguments:
>
> For example,
> f = {f1, f2, f3}
> a = {a1,a2,a3}
>
> I would like to return
> {f1[a1],f2[a2],f3[a3]}
>
> I thought this should easy, but am stumped. Obviously the lists are of
> equal, but arbitrary length, and the arguments may or may not be atomic
> expressions. In my particular case, the arguments are likely to be
> combinations of Real, and List[Real,...], but I hope this is
> irrelevant.
>
> Any suggestions?
>
> Many thanks,
>
> Derek Yates
>
>