       Re: How to extract functions from a list and call them with any argument?

• To: mathgroup at smc.vnet.net
• Subject: [mg65932] Re: [mg65919] How to extract functions from a list and call them with any argument?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Mon, 24 Apr 2006 06:01:30 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```funclist={Sin[x],x^3,Cos[x]^2};

Use Set rather than SetDelayed

Clear[f];
f[x_]=funclist[];

f

sin(2)

or use Evaluate with SetDelayed

Clear[f];
f[x_]:=Evaluate[funclist[]];

f

sin(3)

Bob Hanlon

>
> From: dmp55 at sympatico.ca
To: mathgroup at smc.vnet.net
> Subject: [mg65932] [mg65919] How to extract functions from a list and call them with
any argument?
>
> I have a list of functions, i.e.,
>
> funclist = {Sin[x], x^3, Cos[x]^2}.
>
> I can extract each of the functions, like
>
> In:=funclist[]
> Out=Sin[x]
>
> , but I don't know how to call these functions with a general argument.
> If I type
>
> In:=funclist[t][]
>
> , I get
>
> Out=t
>
> instead of Sin[t] (or t^3 or Cos[t]^2)
>
> What I would like is to extract a function from the list and to call it
> with any argument, as it was defined in a standard way:
> f[x_]:=Sin[x].
>
> Dom
>
>

```

• Prev by Date: Re: How to extract functions from a list and call them with any argument?
• Next by Date: Re: solving a set of inequalities
• Previous by thread: Re: How to extract functions from a list and call them with any argument?
• Next by thread: Re: How to extract functions from a list and call them with any argument?