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

*To*: mathgroup at smc.vnet.net*Subject*: [mg128482] Re: How do I assign the solution obtained by FindRoot to a variable?*From*: Nan-Sheng Lin <nansheng.lin at gmail.com>*Date*: Wed, 24 Oct 2012 03:31: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>

Thank you very much for all the responses I received. I did not realize that I only replied to the sender, and not cc-ing the group. Anyway, all the responses have been helpful, and it is clear to me now. I do have a follow-up question - how do I use FindRoot[] or any other function to find ALL the roots of a non-polynomial function within a specified range? Thanks! NS On Tue, Oct 23, 2012 at 8:11 AM, Bob Hanlon <hanlonr357 at gmail.com> wrote: > 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 > > >

**References**:**How do I assign the solution obtained by FindRoot to a variable?***From:*NS Lin <nansheng.lin@gmail.com>