[Python-ideas] PEP 485: A Function for testing approximate equality

Chris Barker chris.barker at noaa.gov
Tue Jan 27 02:10:44 CET 2015


On Mon, Jan 26, 2015 at 12:52 PM, Paul Moore <p.f.moore at gmail.com> wrote:

> [details snipped]
>


> The point I was trying to make earlier (which came across as "nobody
> should be coding their own Newton iterations")


well, some people should ;-)



> is essentially this -
> surely iterating a relation until the value you need converges is a
> common operation, and libraries exist that do this for you?


sure --


> FWIW, a quick google search came up with scipy.optimize.fixed_point,
> which is, AFAICT, the equivalent of your iterate(). (You probably know
> better than I do if that's the case).
>

Sure -- scipy.optimize is full of all sorts of optimizers suited to various
problems such as these. However, sometimes you have your particular problem
and you just want to get an answer without bringing the while dependency of
scipy (or whatever) to bear, and figure out how to use the darn thing. --
and which one to use.

I really did write that function in grad school -- despite having  MATLAB
and its optimization package (not to mention the  Fortran minpack)
available.

That being said .. if if we want to say the primary use case is testing
that's fine with me -- just please not buried in unittest.TestCase
somewhere.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150126/a141239a/attachment.html>


More information about the Python-ideas mailing list