Numeric root-finding in Python

Robert Kern robert.kern at gmail.com
Sun Feb 12 08:52:48 EST 2012


On 2/12/12 6:41 AM, Steven D'Aprano wrote:
> This is only peripherally a Python problem, but in case anyone has any
> good ideas I'm going to ask it.
>
> I have a routine to calculate an approximation of Lambert's W function,
> and then apply a root-finding technique to improve the approximation.
> This mostly works well, but sometimes the root-finder gets stuck in a
> cycle.

I don't have any advice for fixing your code, per se, but I would just grab 
mpmath and use their lambertw function:

http://mpmath.googlecode.com/svn/trunk/doc/build/functions/powers.html#lambert-w-function

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list