[Boost-bugs] [Boost C++ Libraries] #11027: Add Lambert W function

Subject: [Boost-bugs] [Boost C++ Libraries] #11027: Add Lambert W function
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-14 18:21:06


#11027: Add Lambert W function
------------------------------+----------------------------
 Reporter: johnmaddock | Owner: johnmaddock
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost 1.57.0 | Severity: Not Applicable
 Keywords: |
------------------------------+----------------------------
 Thomas Lui supplied the following code via email:

 {{{
 double plog(double x)
 {
   if (x == 0) {
     return 0;
   }

   double w0, w1;
   if (x > 0) {
     w0 = log(1.2 * x / log(2.4 * x / log1p(2.4 * x)));
   } else {
     double v = 1.4142135623730950488 * sqrt(1 + 2.7182818284590452354 *
 x);
     double N2 = 10.242640687119285146 + 1.9797586132081854940 * v;
     double N1 = 0.29289321881345247560 * (1.4142135623730950488 + N2);
     w0 = -1 + v * (N2 + v) / (N2 + v + N1 * v);
   }

   while (true) {
     double e = exp(w0);
     double f = w0 * e - x;
     w1 = w0 - f / ((e * (w0 + 1) - (w0 + 2) * f / (w0+w0 + 2)));
     if (fabs(w0 / w1 - 1) < 1.4901161193847656e-8) {
       break;
     }
     w0 = w1;
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11027>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC