Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13953

Re: Using FindRoot for Numerical Solutions

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Using FindRoot for Numerical Solutions
Date 2013-03-29 09:56 +0000
Message-ID <kj3ofi$26o$1@smc.vnet.net> (permalink)
References <20130328155619.3BACF6A09@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


>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@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
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Using FindRoot for Numerical Solutions Bob Hanlon <hanlonr357@gmail.com> - 2013-03-29 09:56 +0000

csiph-web