Post Reply 
New Sum of Powers Log Function
03-30-2021, 04:35 PM
Post: #9
RE: New Sum of Powers Log Function
Hi, Namir

The algorithm for LambertW -1 branch is the same as W0, just different guess, see here

y = W-1(a) is real only for a = [-1/e, 0]

A simple way is just iterate for it: y = log(-a), then iterate y = log(a/y) ...
If converged, y=log(a/y)  ⇒ e^y = a/y  ⇒ y*e^y = a

>>> a = mpf(-0.005) # example
>>> y = log(-a)
>>> for i in range(5): y = log(a/y); print y
...
-6.9657066586895
-7.23931642716726
-7.27784415235106
-7.28315205198181
-7.28388110922369

We could speed up convergence with Newton's method

f(y) = y - log(a/y)
f'(y) = 1 + 1/y

y = y - (y-log(a/y))/(1+1/y) = y * (1+log(a/y))/(1+y)

>>> y = log(-a) # same guess
>>> for i in range(5): y *= (1+log(a/y))/(1+y); print y
...
-7.3536234060935
-7.28404934413218
-7.28399713512886
-7.28399713509908
-7.28399713509908

>>> y*exp(y) # confirm y = W-1(a)
-0.005
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
New Sum of Powers Log Function - Namir - 03-29-2021, 04:53 PM
RE: New Sum of Powers Log Function - C.Ret - 03-29-2021, 08:39 PM
RE: New Sum of Powers Log Function - Namir - 03-30-2021, 11:05 AM
RE: New Sum of Powers Log Function - Albert Chan - 03-30-2021 04:35 PM
RE: New Sum of Powers Log Function - Gene - 03-30-2021, 01:43 PM
RE: New Sum of Powers Log Function - C.Ret - 03-30-2021, 04:01 PM
RE: New Sum of Powers Log Function - Namir - 03-30-2021, 05:56 PM
RE: New Sum of Powers Log Function - Namir - 03-31-2021, 01:27 PM
RE: New Sum of Powers Log Function - Namir - 03-31-2021, 02:19 PM
RE: New Sum of Powers Log Function - Namir - 04-01-2021, 06:05 PM
RE: New Sum of Powers Log Function - Namir - 04-01-2021, 11:55 PM
RE: New Sum of Powers Log Function - Namir - 04-04-2021, 03:41 PM



User(s) browsing this thread: 1 Guest(s)