Re: use Solve[...] result as a function
- To: mathgroup at smc.vnet.net
- Subject: [mg68211] Re: use Solve[...] result as a function
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 29 Jul 2006 01:00:44 -0400 (EDT)
- References: <eaa198$n81$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
alandwehr at freesurf.ch schrieb:
> Hello
>
> Does anybody know how to use a result of Solve[...] as a function?
> i.e. Solve gives me the result {x->x^2}. Now I want to use the result
> as a function f[x]. How does this work.
>
> Thank you very much for your help.
>
> Ananda
>
Hi Ananda,
try
In[1]:= f = Function @@ First[{x -> x^2}]
Out[1]= Function[x, x^2]
In[2]:= f[z]
Out[2]= z^2
but I'm pretty sure, Solve[] would not return {x->x^2}, but {x->0,x->1}.
If Solve returns {y->x^2}, f=Function@@First[{y->x^2}/.y->x] should work.
Peter