MathGroup Archive 2012

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

Search the Archive

Re: How do I assign the solution obtained by FindRoot to a variable?


eqn = Sin[x] + Exp[x];

z = x /.
  FindRoot[eqn, {x, 0}]

-0.588533

eqn /. x -> z

0.

eqns = {Exp[x - 2] == y, y^2 == x};

{r, s} = {x, y} /.
  FindRoot[eqns,
   {{x, 1}, {y, 1}}]

{0.019026, 0.137935}

eqns /. {x -> r, y -> s}

{True, True}


Bob Hanlon


On Tue, Oct 23, 2012 at 12:54 AM, NS Lin <nansheng.lin at gmail.com> wrote:
> I would like to store the root/solution obtained by the FindRoot[] function to a variable.  How can I do that?
>
> Thanks!
>
> NS
>



  • Prev by Date: Eigenvalues works very slow
  • Next by Date: Re: How do I assign the solution obtained by FindRoot to a variable?
  • Previous by thread: How do I assign the solution obtained by FindRoot to a variable?
  • Next by thread: Re: How do I assign the solution obtained by FindRoot to a variable?