Re: How to convert the expression 3*x to a function in Mathematica?

*To*: mathgroup at smc.vnet.net*Subject*: [mg128458] Re: How to convert the expression 3*x to a function in Mathematica?*From*: Bob Hanlon <hanlonr357 at gmail.com>*Date*: Mon, 22 Oct 2012 02:01:32 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <20121021061016.A03EE684B@smc.vnet.net>

Note that Function has the attribute HoldAll Attributes[Function] {HoldAll, Protected} convert[f_] := Function[ Evaluate[Cases[f, _Symbol?(! NumericQ[#] &), Infinity]], Evaluate[f]] f = 3*x; g = convert[f] Function[{x}, 3 x] g[z] 3 z f = Sin[x + y]; g = convert[f] Function[{x, y}, Sin[x + y]] g[r, s] Sin[r + s] Bob Hanlon On Sun, Oct 21, 2012 at 2:10 AM, <pedro_fr_22 at hotmail.com> wrote: > In doing a program in Mathematica that receives an expression called f and converts it to a function. However the command Function[x,f] doesn't work, what do I do? >

**References**:**How to convert the expression 3*x to a function in Mathematica?***From:*pedro_fr_22@hotmail.com