MathGroup Archive 2009

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

Search the Archive

NSolve vs. N[Solve ]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103423] NSolve vs. N[Solve ]
  • From: Helen Read <hpr at together.net>
  • Date: Mon, 21 Sep 2009 05:51:07 -0400 (EDT)
  • Reply-to: HPR <read at math.uvm.edu>

A while back (I forget what version), N was modified so that it will 
give output to any number of significant digits that you desire. 
Previously, N[x,k] would output 6 significant digits if k was anything 
less than machine precision. Asking for N[x,3] or N[x,15] or whatever 
would give output to 6 significant digits, while N[x,k] for k>=16 would 
give x to k significant digits.

Lately my students have been using NSolve with a third argument (for the 
precision) -- which I hadn't told them about -- to solve a problem that 
I was actually expecting them to do a different way. What they did was a 
reasonable solution, but unfortunately they didn't notice that their 
results from NSolve were not coming out to the number of significant 
digits that they asked for. Evidently NSolve behaves like the old N, and 
differs from N[Solve ]

For example, compare these:

NSolve[E^x==10,x,3]  (* result given to 6 significant digits, despite 
asking for only 3 *)

N[Solve[E^x==10,x],3]  (* result given to the desired precision *)

NSolve[E^x == 10, x, 12]  (* result given to only 6 significant digits, 
despite asking for 12 *)

N[Solve[E^x==10,x],12]  (* result given to the desired precision *)

I hadn't noticed this unfortunate behavior until I started seeing it in 
my students' work.

-- 
Helen Read
University of Vermont


  • Prev by Date: Re: notebook formatting error
  • Next by Date: Re: Replace not spotting a replacement
  • Previous by thread: Google Groups Broken Again
  • Next by thread: Re: NSolve vs. N[Solve ]