Re: convergence checking

*To*: mathgroup at smc.vnet.net*Subject*: [mg70295] Re: [mg70002] convergence checking*From*: Darren Glosemeyer <darreng at wolfram.com>*Date*: Thu, 12 Oct 2006 05:36:58 -0400 (EDT)*References*: <200609300912.FAA13091@smc.vnet.net>

Inequalities along this line are mentioned in the documentation for PrecisionGoal and AccuracyGoal. One way to implement this is via a While loop of the following form old=(* insert or compute initial value here *); new=(* insert or compute next iteration here *); While[Abs[new-old]>=10^(-acc)+Abs[old]*10^-(prec), old=new; new=(* insert or compute next iteration here *)]; new To avoid a non-terminating loop in cases where the method does not converge, you can add a counter variable that gets incremented at each step in the While loop and checked against an iteration limit in the While test. Alternately, NestWhile could be used to put a cap on the number of iterations. Darren Glosemeyer Wolfram Research Chris Chiasson wrote: > Somewhere in the Mathematica documentation, there is an expression like > > Abs[new-old]<10^(-acc)+Abs[old]*10^-(prec) > > suggested for use as a convergence criteria. I can't find it again, > and I'm hoping someone will point me to it. > > Also, if you have any pointers about checking convergence (ignoring > other factors like movement along a contour line causing large changes > in the solution but no changes in function value), I would like to > hear them. > > The dicussion at > > http://www.library.cornell.edu/nr/bookcpdf/c10-1.pdf > > (around eqn 10.1.2) > > is interesting, though I am not sure I understand how to implement it > (in the context of Mathematica programming of an optimization > routine). > >