Re: General--Using FindRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg69081] Re: General--Using FindRoot
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 30 Aug 2006 06:32:03 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ed0s79$sqk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
batman_forever at email.it wrote:
> after using the command Findroot to find the approssimate solution, I have to use this number for other steps.
> the solution is k --> 0.12657
> how I can define automatically a variable k2 = 0.12657 so I can insert this in another expression?
Use the replacement operator since FindRoot returns a list of
replacement rules:
sol = FindRoot[Sin[k] == Cos[k], {k, 1}]
--> {k -> 0.7853981633974483}
k2 = k /. sol
--> 0.7853981633974483
k2 = k /. FindRoot[Sin[k] == Cos[k], {k, 1}]
--> 0.7853981633974483
HTH,
Jean-Marc