MathGroup Archive 1997

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

Search the Archive

RE: Help with findroot

  • To: mathgroup at
  • Subject: [mg9236] RE: [mg9202] Help with findroot
  • From: Ersek_Ted%PAX1A at
  • Date: Fri, 24 Oct 1997 01:00:50 -0400
  • Sender: owner-wri-mathgroup at

Following up on the discussion between Sean Ross and Karl: |>
|> I'm having a problem using findroot to solve an equation.  Perhaps |>
|>  could shed some light on what's wrong. |>
|> FindRoot[Sqrt[x/(1.2 10^ -4)]==-0.1*Tan[Sqrt[x/(1.2*10^ |>
|To shed some light on what is happening, try plotting both |sides of
your equation independently and see where they cross  ie: |

    I think it's better to plot the difference between the left hand
side  and right hand side.
The solution is where the difference is zero.  I think this is why the 
command is called FindRoot instead of FindEqual.

|There are two methods that come to mind. |
|1) Engineering approach.  Tangent changes value so rapidly near the
|roots that any kind of precision is going to be both hard to achieve
|and potentially meaningless, so just do the graphic solution and let
|the roots be equal to the vertical asymptotes of Tangent, ie
x/(1.2*10^ |-4)=n Pi/2.  Before proceeding, ask yourself exactly why
you need those |roots and how much precision you need and how hard you
are willing to |work to get it.
    I agree with the above.
|2)  For really ugly root finding problems, the Bisection method is
|usually the best.  It is generally the first algorithm mentioned in
|Numerical Methods textbooks because it is very simple.  It is
|comparatively slow, but always converges and does not depend on
|derivatives or slopes.
However, Mathematica will use Brent's method if f[x_]:= (left hand side
- right hand side) has opposite sign at the two initial guesses.

Brent's method is very effective.
It's uses a combination of bisection and 2nd order inverse
interpolation. If you are interested read about Brent's method in
Numerical Recipes in C.

Brent's method is also guaranteed to converge, and doesn't need values
of  the functions derivatives.

If your problem has any practical significance, and the function is 
continuous at a first order root you can be pretty sure Brent's method
will  converge faster than bisection.  Usually 8-12 iterations does the

However, the Bisection method will converge the fastest in the worst
case  scenario.

Note:  I have special bag of tricks for efficiently finding a multiple
            e-mail me if you are interested.

|As a general point of problem solving technique, it is usually a good
|idea to learn as much about your problem as you can before attempting
|to solve it.  In your case, graphing out the functions would have told
|you that something was fishy before starting out.  It also shows that
|no collection of canned routines(like mathematica) can substitute for
a |working knowledge of numerical methods. |

I agree with the above.

     Ted Ersek
     ersek_ted%pax1a at

  • Prev by Date: Re: Horse Race Puzzle
  • Next by Date: Re: Help with findroot
  • Previous by thread: Re: Help with findroot
  • Next by thread: Re: Help with findroot