[SciPy-dev] Lambert W implementation

Yosef Meller mellerf@netvision.net...
Fri Oct 30 03:54:40 CDT 2009

ציטוט Pauli Virtanen:
> Thu, 29 Oct 2009 14:54:31 -0400, Skipper Seabold wrote:
>> On Thu, Oct 29, 2009 at 1:04 PM, Yosef Meller <mellerf@netvision.net.il>
>> wrote:
>>> Hello,
>>> I searched through scipy.special and I saw no implementation of the
>>> Lambert W function. I'd like to add one, but before I do I thought I'd
>>> ask:
>>> 1) Did I just miss it?
>>> 2) Is there any implementation you know off that is suitable for
>>> wrapping or a good reference for an algorithm (I can find some, but if
>>> there's something well known...)
>> There's a Python example on the wikipedia page for Lambert W that works
>> for W(x) where x >= -1/e.  There's probably more information in the
>> references for more general implementations and/or improved accuracy.
> There's an implementation of lambertw in mpmath. It probably doesn't rely 
> on arbitrary precision either, so might just work with floats.

Ok, the mpmath implementation seems suitable, and they also have a 
reference and some test values. What I see as the way forward is to take 
all mpmath-related wrapping out and provide a simpler floating-point 
version. I think I'll do a Cython function for scalar argument, then 
count on the usual vectorization facilities in NumPy to handle the rest 

More information about the Scipy-dev mailing list