Re: Assigning solutions found by FindRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg9715] Re: Assigning solutions found by FindRoot
- From: jthan at world.std.com (Jonathan M Richardson)
- Date: Tue, 25 Nov 1997 00:06:11 -0500
- Organization: The World Public Access UNIX, Brookline, MA
- Sender: owner-wri-mathgroup at wolfram.com
Des Penny (penny at suu.edu) wrote:
Christian Zemlin wrote:
> Hello everybody,
>
> I use FindRoot to solve systems of around ten equations and I would like
> to use the results for further computation. Therefore, I need a
> function that assigns the computed solution to the variables. For
> example:
>
> In[1] := FindRoot[{x == y, x + y == 2}, {x, 0}, {y, 0}] Out[1] := {x ->
> 1., y -> 1.}
>
> In[2] := **Command I am looking for ** Out[2] := ** Now, x is set to 1
> and y is set to 1 **
>
> Can anybody help me with this?
>
> Thanks,
> Chris
Here is the way I typically do it:
In[1]:=
s = Solve[x^2 + 3 x + 2 == 0,x]
Out[1]=
{{x -> -2},{x -> -1}}
In[2]:=
xsol1=x/.s[[1]]
Out[2]=
-2
In[3]:=
xsol2 = x/.s[[2]]
Out[3]=
-1
-Jonathan