MathGroup Archive 1998

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

Search the Archive

Re: FindRoot accuracy/precision



Michael Chang wrote:
> 
> Hallo!
> 
> I'm running Mathematica 3.0 on a PC (with Windows 95).
> 
> I'm trying to use FindRoot to solve the roots for *seven* nonlinear
> equations with seven variables.  I use Random to generate seven
> (positive real) initial starting points for FindRoot, and continuously
> run FindRoot until seven candidate (positive real) roots are found.
> 
> The basic text is as follows:
> 
> ok=0; While[ok==0,
> ans=FindRoot[eq1==eq2,{x1,Random[Real,x1upper]},
> {x2,Random[Real,x2upper]}, (etc.)]; If[Min[ans]>=0, ok=1; Print[ans]]]
> 
> In the above text, eq1 is a list of numerical values, and eq2 is a list
> of symbolic equations. The problem is that when evaluated (i.e.
> eq2/.ans), only *one* of my seven equations appears `close' in value;
> this particular equation also yields the largest numerical value
> (4*10^2), while the other values should get smaller (all the way down
> to 10^-13).  (I know that this large spread in values is part of my
> problem.)
> 
> So ... how can I get Mathematica to FindRoots more accurately?  My
> $MachinePrecision is 16 (which cannot be changed, I believe).
> Precision of eq1 (my numerical values) only seems to be 16.  Is this my
> problem (i.e. should this be infinity)?  I've tried changing
> WorkingPrecision in FindRoots, but this doesn't seem to have any
> effect!
> 
> In essence, I'm trying to find out how the result of FindRoot can yield
> 
> eq1 (approximately=) eq2/.ans
> 
> Currently, this does *not* occur except for the first element of my
> list.  The other elements are sometimes one+ order of magnitude off and
> are decreasing in magnitude to order(10^-13).
> 
> I'd be grateful for any and all suggestions/advice concerning this
> pressing problem of mine!
> 
> Thanks in advance!
> 
> Mike


It is a bit difficult to understand your question; perhaps the actual
example would be of help. Without that, I can make a suggestion or two.
First, subtract right-hand-side from left-hand-side of each equation
and put zero on each right-hand-side. Now you will always be comparing
to zero. If nothing else, this will make it less likely for confusing
terminology such as

> eq1 (approximately=) eq2/.ans

to arise.

Second, you might try to play with the options AccuracyGoal and
MaxIterations. Raise the latter, say, to 100 (default is 15), and take
AccuracyGoal to be, say, 20. This will make FindRoot attempt to find
roots that give residuals around 10^(-20), if I remember correctly the
details. In any case, FindRoot will try harder than it would by
default, and you will be able to see if you are getting better results.


Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: combine two vectors to form matrix
  • Next by Date: Re: algebraic solutions
  • Prev by thread: FindRoot accuracy/precision
  • Next by thread: Re: FindRoot accuracy/precision