Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Change in NSolve algorithm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98537] Re: Change in NSolve algorithm
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Sun, 12 Apr 2009 03:46:22 -0400 (EDT)
  • References: <grpif7$lnr$1@smc.vnet.net>

On Apr 11, 10:56 am, mark mcclure <mcmcc... at unca.edu> wrote:
> Has anyone noticed that the algorithm used by NSolve has
> changed in V7?  I think the change is mostly for the better,
> but not exclusively.  To see the change, enter the following
> in both V7 (7.0.0 or 7.0.1) and any version < 7.0:
>   Abs[sols = z /. NSolve[z^200 == 1, z]]
>
> In V7, Mathematica correctly generates a list of 1.0s.  In
> versions prior to V7, numerical error creeps in so you get
> numbers ranging from 0.004 to 2.55.  V7 is noticeably faster,
> too.  To visualize the error in V6, you can enter
>   ListPlot[{Re[#], Im[#]} & /@ sols,
>     AspectRatio -> Automatic]
>
> Of course, you should get a circle.
>
> On the other hand, V7 fares slightly worse with Wilkinson's
> polynomial:
>   sols = x/.NSolve[Expand[Product[x-i, {i,1,20}] == 0,x]];
>   Norm[Table[sols[[i]] - i, {i, 1, 20}]]
>
> I get 0.087351 from V6 and 0.26578 in V7.  Also, V6 returns
> all real solutions, while V7 returns some complex.
>
> Of course, the change is platform independent.  I haven't
> played with it extensively, but I think this is probably a
> net big improvement.
>

Thank you, Mark, for this little demonstration!

For the people reading this post and wondering about whether
Mathematica can find more accurate solutions to those equations: using
the WorkingPrecision option with a non-machine-precision setting will
usually improve the results (but the computation will take longer).


  • Prev by Date: Re: Help with Recursive Minimization
  • Next by Date: Re: AMERICAN MATHEMATICAL MONTHLY -April 2009:Transformations Between
  • Previous by thread: Re: what went wrong in this ordinary differential eq
  • Next by thread: Re: Change in NSolve algorithm