
On 23 January 2015 at 18:10, Guido van Rossum <guido@python.org> wrote:
On Fri, Jan 23, 2015 at 9:59 AM, Paul Moore <p.f.moore@gmail.com> wrote:
Guido's example of Newton iteration is a good use case (although most of the time I'd expect to use a prebuilt function from a module, rather than build it myself with Newton iteration, but maybe that just reflects the fact that I don't do numerical programming).
Well duh. Any algorithm that isn't already in the math module would require way too much code. The point of the example is that most people have probably seen that algorithm before, and it's only one simple step, really, so they won't be distracted by trying to understand the algorithm when the point of the example is to show how you would use is_close_to(). (And it's one of the simplest algorithms that gives an *approximation*, not an exact answer, at least not in the mathematical sense, which is also important in this case -- if the algorithm was exact there would be no need to use is_close_to().)
Sorry. What I was trying to say is that if I had a need for say a Bessel function, or numerical integration, or a zero of a function, I'd go hunting for a package that implemented it (something like mpmath, maybe) rather than rolling my own numerical algorithm using is_close_to(). But I do agree, that implementing numerical algorithms is a good use of is_close_to. And your example was fine, it'd make a good addition to use cases in the PEP. (But I wonder - wouldn't it work better with a "symmetrical" close-to function? That's probably a question for Chris.) Paul