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?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128479] Re: How do I assign the solution obtained by FindRoot to a variable?
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Wed, 24 Oct 2012 03:30:47 -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: <20121023045437.AE4F2685C@smc.vnet.net>

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?