Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12142
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to convert the expression 3*x to a function in Mathematica? |
| Date | 2012-10-22 06:11 +0000 |
| Message-ID | <k62o29$chm$1@smc.vnet.net> (permalink) |
| References | <20121021061016.A03EE684B@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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@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?
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: How to convert the expression 3*x to a function in Mathematica? Bob Hanlon <hanlonr357@gmail.com> - 2012-10-22 06:11 +0000
csiph-web