Re: Beware of NSolve - nastier example

• To: mathgroup at smc.vnet.net
• Subject: [mg50414] Re: Beware of NSolve - nastier example
• From: carlos at colorado.edu (Carlos Felippa)
• Date: Thu, 2 Sep 2004 04:34:54 -0400 (EDT)
• References: <200408200858.EAA12533@smc.vnet.net> <cg6srb\$odf\$1@smc.vnet.net> <200408280837.EAA19074@smc.vnet.net> <200408311028.GAA18653@smc.vnet.net> <opsdluzdvziz9bcq@monster.cox-internet.com> <ch3olv\$33\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```DrBob <drbob at bigfoot.com> wrote in message news:<ch3olv\$33\$1 at smc.vnet.net>...
> 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:

ClearAll[f,x];
f=(5/432-11/(27*Sqrt[70]*Sqrt[19-1890*x])+x/(2*Sqrt[38/35-(108+1/10000000)*x]));
fprime=D[f,x];
Print[N[Solve[f==0,x]]//InputForm];  (* gives 3 correct roots *)

SetPrecision[{xn,xnext,r,f,fprime,fp},16];
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