Re: How to convert a list of functions in a list valued function
- To: mathgroup at smc.vnet.net
- Subject: [mg28296] Re: [mg28253] How to convert a list of functions in a list valued function
- From: jmt <jmt at agat.net>
- Date: Sat, 7 Apr 2001 03:44:57 -0400 (EDT)
- References: <200104060553.BAA28862@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Suppose your functions are :
f1=#&
f2=#^2&
f3=#^3&
You can define f[x] by :
f[x_]=Through[List[f1,f2,f3][x]]
and then, for instance :
f[2] will give
{2,4,8}
If the functions are defined in a list, i.e.
funlist={f1,f2,f3}
you can use
f[x_]=Through[List[Sequence@@funlist][x]]
On Friday 06 April 2001 07:53, Thomas Neff wrote:
> I have a list of functions, say
>
> funlist = {f1, f2, f3, ..., fn}
>
> I want to construct a function f, so that
>
> f[x] gives the list {f1[x], f2[x], f3[x], ... fn[x]}
>
> f[x_] = funlist[x] doesn't work ;-(
>
> Is there an elegant way to do this in Mathematica ?
>
>
> Thanks
>
> Thomas
- References:
- Howto vonvert a list of functions in a list valued function
- From: Thomas Neff <t.neff@gsi.de>
- Howto vonvert a list of functions in a list valued function