Re: How do I assign the solution obtained by FindRoot to a variable?
- To: mathgroup at smc.vnet.net
- Subject: [mg128477] Re: How do I assign the solution obtained by FindRoot to a variable?
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Wed, 24 Oct 2012 03:30:07 -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: <k658dg$h6c$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 10/23/2012 12:02 AM, NS Lin wrote:
> I would like to store the root/solution obtained by the FindRoot[] function to a variable.
>How can I do that?
>
In[7]:= Clear[x]
sol=FindRoot[Sin[x]+Exp[x],{x,0}]
Out[8]= {x->-0.588533}
In[9]:= x=x/.sol
Out[9]= -0.588533
In[10]:= x
Out[10]= -0.588533