Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Beware of NSolve - nastier example

  • To: mathgroup at
  • Subject: [mg50414] Re: Beware of NSolve - nastier example
  • From: carlos at (Carlos Felippa)
  • Date: Thu, 2 Sep 2004 04:34:54 -0400 (EDT)
  • References: <> <cg6srb$odf$> <> <> <> <ch3olv$33$>
  • Sender: owner-wri-mathgroup at

DrBob <drbob at> wrote in message news:<ch3olv$33$1 at>...
> Oops, in my last paragraph I claimed convergence for a wider range of starting values than I actually get. (I had a typo when doing some of the tests.) 0.003`n to 0.04`n looks fine. At least it converges for SOME input, which is more than the raw Newton iteration can do.
> Of course, I used Solve to get the h function--the same Solve routine that solved the original problem already!

No problem whatsoever for conventional NR in 16-digits 
(double precision) if you are sufficiently near a root.  Just run this
NR iteration, which is at the level of the homeworks I assign to
engineering sophomores:

Print[N[Solve[f==0,x]]//InputForm];  (* gives 3 correct roots *)

xn=0.0100529100415;  (* the slippery root *)
n=10;   (* actually n=3 is enough  to get limit accuracy *)
For [i=1,i<=n,i++, r=N[f/.x->xn]; fp=N[fprime/.x->xn];
     dx=-r/fp; xnext=xn+dx; 
     Print[{i,r,fp,dx,xn,xnext}//InputForm]; xn=xnext];

The derivative f' is large, O(10^13) whereas the residual goes down to
O(10^(-4)). The interval where NR converges to that root is tiny, of
O(10^(-10), but finite.  If one tries single precision (~ 6-7 digits)
NR fails, as noted by Daniel Lichtblau,  since the convergence
interval falls in the noise.

What  is a bit surprising to me is that NSolve applied directly to f,
(not as N[Solve][..]]) needs 128-digit working precision to resolve
that root.

  • Prev by Date: Sorting (again!), but with multiple columns
  • Next by Date: Martix reconstruction by tensors of nonlinearity in an interger sequence
  • Previous by thread: Re: Re: Re: Beware of NSolve - nastier example
  • Next by thread: Re: Re: Beware of NSolve - nastier example