Re: use Solve[...] result as a function
- To: mathgroup at smc.vnet.net
- Subject: [mg68209] Re: use Solve[...] result as a function
- From: "Robert C. Helling" <robert at atdotde.iu-bremen.de>
- Date: Sat, 29 Jul 2006 01:00:42 -0400 (EDT)
- References: <eaa198$n81$1@smc.vnet.net>
- Reply-to: helling at atdotde.de
- Sender: owner-wri-mathgroup at wolfram.com
On Thu, 27 Jul 2006 09:33:28 +0000 (UTC), alandwehr at freesurf.ch <alandwehr at freesurf.ch> wrote:
> 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
Solve returns the solutions as a list of replacement rules. Say you
want want to assign the first one to f[x]. Have you tried
f[x_] := x /. Solve[equation, x][[1]]
BTW, what kind of equation are you solving where the solution for
variable x is a function of x (i.e. x^2)?
If this is a typo you might mean something like
f[x_] := y /. Solve[y^2 + x^2 == 1,y][[1]]
Robert
--
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling School of Engineering and Science
International University Bremen
print "Just another Phone: +49/421/200-3574
stupid .sig\n"; http://www.aei-potsdam.mpg.de/~helling