|
[Date Index]
[Thread Index]
[Author Index]
Re: Beware of NSolve - nastier example
- To: mathgroup at smc.vnet.net
- Subject: [mg50218] Re: [mg50207] Beware of NSolve - nastier example
- From: DrBob <drbob at bigfoot.com>
- Date: Sat, 21 Aug 2004 03:04:19 -0400 (EDT)
- References: <200408200858.EAA12533@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
I hate to picture you typing in all those unnecessary Print statements, when this does exactly the same thing:
f = 5/432 - 11/(27*Sqrt[70]*Sqrt[19 - 1890*x]) + x/(2*Sqrt[38/35 - (108 + 1/10000000)*x]);
N[Solve[f == 0, x]](*OK, 3 roots #2, 4, 5 of a sextic poly*)
NSolve[f, x, 16](*6 roots, 3 wrong*)
NSolve[f, x, 21](*4 roots, 2 correct, 1 double wrong, 1 single wrong*)
NSolve[f, x, 24](*3 roots, 1 wrong*)
NSolve[f, x, 28](*3 roots, 1 wrong*)
NSolve[f, x, 32](*2 correct roots, missed 1*)
NSolve[f, x, 64](*2 correct roots, missed 1*)
NSolve[f, x, 128](*3 correct roots*)
Anyway, I think you just proved that Solve works better than NSolve for that problem.
Congratulations!
Bobby
On Fri, 20 Aug 2004 04:58:03 -0400 (EDT), Carlos Felippa <carlos at colorado.edu> wrote:
> This is a nasty one:
>
> f=5/432-11/(27*Sqrt[70]*Sqrt[19-1890*x])+x/(2*Sqrt[38/35-(108+1/10000000)*x]);
>
> Print[N[Solve[f==0,x]]]; (* OK, 3 roots #2,4,5 of a sextic poly *)
> Print[NSolve[f,x,16]]; (* 6 roots, 3 wrong *)
> Print[NSolve[f,x,21]]; (* 4 roots, 2 correct, 1 double wrong,
> 1 single wrong *)
> Print[NSolve[f,x,24]]; (* 3 roots, 1 wrong *)
> Print[NSolve[f,x,28]]; (* 3 roots, 1 wrong *)
> Print[NSolve[f,x,32]]; (* 2 correct roots, missed 1 *)
> Print[NSolve[f,x,64]]; (* 2 correct roots, missed 1 *)
> Print[NSolve[f,x,128]]; (* 3 correct roots *)
>
> All 3 roots are single and well conditioned, no problem getting them
> in single precision with NR.
>
> Note: please reply to this newsgroup; DONT send mail to me directly
> (there is a white list, if not in list your msg >null)
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
Prev by Date:
Re: Beware of adding 0.0
Next by Date:
Re: Label of Max[list]
Previous by thread:
Beware of NSolve - nastier example
Next by thread:
Re: Beware of NSolve - nastier example
|