MathGroup Archive 2013

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

Search the Archive

Re: Using FindRoot for Numerical Solutions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130253] Re: Using FindRoot for Numerical Solutions
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Fri, 29 Mar 2013 05:56:31 -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: <20130328155619.3BACF6A09@smc.vnet.net>

>From the documentation for FindRoot (
http://reference.wolfram.com/mathematica/ref/FindRoot.html ):

"FindRoot returns a list of replacements for x, y, ... , in the same
form as obtained from Solve."

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

sol = FindRoot[eqns, {{x, 1}, {y, 1}}]

{x -> 0.019026, y -> 0.137935}

The arrow-like symbol is \[Rule]

Replacement rules (e.g., Rule[x, value] or x -> value) are used with
Replace, ReplaceAll ( /. ) or ReplaceRepeated ( //. ). For example, to
obtain the numeric values:

{x, y} /. sol

{0.019026, 0.137935}

Or to verify the solution

And @@ (eqns /. sol)

True


Bob Hanlon


On Thu, Mar 28, 2013 at 11:56 AM, Ben Blomberg
<bblomberg at mail.bradley.edu> wrote:
>
> Dear Mathgroup,
>
> I am new to mathematica and I am trying to understand a bit of code written
> by someone else. In the code shown below this person uses FindRoot to find
> numerical solutions to the the equation. However after I run the code if I
> print xplot I get {x->0.386332}. This is hard to see in gmail but that is
> an arrow not a greater than equal to sign. I was hoping someone might be
> able to help me understand what is going on here. Is this x goes to
> 0.386332 like a limit?
>
> Do[xplot = FindRoot[Ucr[x] - (offset + eigenvaluesort[6][[i]]) == 0, {x, 0,
> dp/2}];
>   xx[i] = x /. xplot, {i, 1, n - 1}];
>
> offset, eigenvaluesort dp and Ucr[x] are set equal to values elsewhere in
> the code.
>
> Any help is greatly appreciated,
> Ben
>
>



  • Prev by Date: Re: cubic equation solver
  • Next by Date: Re: Using FindRoot for Numerical Solutions
  • Previous by thread: Using FindRoot for Numerical Solutions
  • Next by thread: Re: Using FindRoot for Numerical Solutions