MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: General--Using FindRoot


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


  • Prev by Date: Re: restart?
  • Next by Date: RE: restart?
  • Previous by thread: Re: General--Using FindRoot
  • Next by thread: Re: General--Using FindRoot