[Date Index]
[Thread Index]
[Author Index]
Re: Help with findroot
*To*: mathgroup at smc.vnet.net
*Subject*: [mg9202] Re: [mg9169] Help with findroot
*From*: seanross at worldnet.att.net
*Date*: Tue, 21 Oct 1997 02:03:15 -0400
*Sender*: owner-wri-mathgroup at wolfram.com
Darrmis wrote:
>
> I'm having a problem using findroot to solve an equation. Perhaps
> someone
> could shed some light on what's wrong.
>
> FindRoot[Sqrt[x/(1.2 10^ -4)]==-0.1*Tan[Sqrt[x/(1.2*10^
> -4)]],{x,0.1,0.1,2}]
>
> Mathematica 3. returns a value of -0.07 for x which is not anywhere
> close to correct.
> Further, I've tried several different starting values and min/max
> limits, but
> a negative answer is always returned. Eventually I'de like to compile
> a list
> of all the roots of the equation up to, say, x=1000, but I can't even
> get one
> right now.
>
> Thanks,
>
> Karl Kevala
Congratulations! You have found a really nasty root finding problem.
First, the FindRoot function uses either Newtons Method or Secant
Method, both of which try to follow the slope of the function to its
root. Neither of these methods is adequate for the problem you are
attempting because the roots of the equation are very near where the
tangent function is undefined and its derivative approaches +/-
infinity. To shed some light on what is happening, try plotting both
sides of your equation independently and see where they cross ie:
Show[Plot[0.1 *Tan[Sqrt[x/(1.2*10^
-4)]],{x,0,.5},DisplayFunction->Identity,PlotPoints->1801],
Plot[Sqrt[x/(1.2 10^ -4)],{x,0,.5},DisplayFunction->Identity],
DisplayFunction->$DisplayFunction,PlotRange->{0,100}]
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.
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. The algorithm says that you have some f[x]
which you want to set=0. Pick an x for f[x]>0 and another one for
f[x]<0 which bound a root. Divide the interval in half. One of the
two sub intervals will bound the root. Pick that subinterval and
divide it into two etc. etc. Do this until you get the precision
desired.
Since each of the vertical asymptotes of Tangent are associated with two
roots, very closely spaced, of your function, the best guesses for
bounding intervals are nPi/2 and nPi/2 +/- .1 .
If you need some help implementing the algorithm, e-mail me back. My
opinion is that there is no built-in function in mathematica that will
magically solve this one. You will have to implement your own
algorithm, but mathematica is a great language to do it in.
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.
Prev by Date:
**Re: Needs[]**
Next by Date:
**Re: Horse Race Puzzle**
Previous by thread:
**Help with findroot**
Next by thread:
**Re: Help with findroot**
| |