An aproximation of the lambertw function for a complex number

Here is my problem, I used the fact that $W(x)=\ln(x)-\ln(W(x))$, replacing $W(x)$ by $\ln(x)-\ln(...$ a lot amount of times and it seems to works for simple $x$ but when I try with, for example, $\ln(-2)/2$ or $i*pi/2+\ln(2)/2$ ,as you like, it doesn't work anymore.

To help you understand the situation I'm in I try to solve $a^b=b^a$ for $a<0$ which means solving $\ln(a)/a=\ln(b)/b$ and as you know $W(-\ln(b)/b)=-\ln(b)$. I can get the result with matlab but most of the time I can't use my computer so I use a Texas Instrument Ti 82 Calculator, I programmed it to calculate real (from $-1/e$ to $+\infty$) Lambert $W$ values and now I try to do it with complex values so i need an algorithmic way to do it.

• Wow... could you put some paragraph breaks in there? :) – apnorton Mar 15 '13 at 1:59

Kennedy,

I've developped in VBA (Excel) a macro which handles the W-Function both in real and imaginary axis. The results for the real part are 100% accurate. As for the imaginary part, I couldn't test it yet, due to the lack in internet of a reliable W-Function calculator for complex numbers. I hope it helps.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Const e As Double = 2.71828182845905

Sub Main()

Dim number(1) As Double, result() As Double

number(0) = 88 'real value number(1) = 1 'imaginary value

result = LambertWc(number)

End Sub

Public Function setComplex(X As Double, y As Double) As Double()

Dim arr(1) As Double arr(0) = X arr(1) = y setComplex = arr

End Function

Public Function ImgSum(ByRef Z1() As Double, Z2() As Double) As Double() Dim K(1) As Double K(0) = Z1(0) + Z2(0) K(1) = Z1(1) + Z2(1)

ImgSum = K

End Function

Public Function ImgSub(ByRef Z1() As Double, ByRef Z2() As Double) As Double() Dim K(1) As Double K(0) = Z1(0) - Z2(0) K(1) = Z1(1) - Z2(1)

ImgSub = K

End Function

Public Function ImgProduct(ByRef Z1() As Double, ByRef Z2() As Double) As Double() Dim K(1) As Double K(0) = Z1(0) * Z2(0) - Z1(1) * Z2(1) K(1) = Z1(0) * Z2(1) - Z1(1) * Z2(0)

ImgProduct = K

End Function

Public Function ImgDiv(ByRef Z1() As Double, ByRef Z2() As Double) As Double() Dim K(1) As Double

K(0) = (Z1(0) * Z2(0) + Z1(1) * Z2(1)) / (Z2(0) ^ 2 + Z2(1) ^ 2) K(1) = (Z1(1) * Z2(0) - Z1(0) * Z2(1)) / (Z2(0) ^ 2 + Z2(1) ^ 2)

ImgDiv = K

End Function

Public Function ImgExponential(ByRef Z() As Double) As Double() Dim K(1) As Double

t = -(Atn(Z(1) / Z(0))) K(0) = (e ^ t) * Cos(Log(((Z(1) ^ 2) + (Z(0) ^ 2))) / 2) K(1) = (e ^ t) * Sin(Log((Z(1) ^ 2 + Z(0) ^ 2)) / 2)

ImgExponential = K

End Function

Public Function ImgSqrt(ByRef Z() As Double) As Double() Dim K(1) As Double, r As Double, t As Double r = Sqr(Z(0) ^ 2 + Z(1) ^ 2) t = Atn(Z(1) / Z(0)) K(0) = Sqr(r) * Cos(t / 2) K(1) = Sqr(r) * Sin(t / 2)

ImgSqrt = K

End Function

Public Function ImgLog(ByRef Z() As Double) As Double() Dim K(1) As Double, r As Double, t As Double r = Sqr(Z(0) ^ 2 + Z(1) ^ 2) t = Atn(Z(1) / Z(0)) K(0) = Log(r) K(1) = t ImgLog = K

End Function

Public Function LambertWc(ByRef W() As Double) As Double() Dim Z() As Double, X() As Double, Z1() As Double, Z2() As Double, Z3() As Double, Q1() As Double

If W(0) = 0 And W(1) = 0 Then Z(0) = 0 Z(1) = 0

Else ' complex parameter

' approx initial value = sqtr(2*(1+e*x))-1
X = W
Z = ImgProduct(X, ImgExponential(setComplex(1, 0)))
Z = ImgProduct(setComplex(2, 0), ImgSum(setComplex(1, 0), Z))

If Z(0) = 0 And Z(1) = 0 Then

Z = setComplex(-1, 0)

Else

Z = ImgSub(ImgSqrt(Z), setComplex(1, 0))

For i = 1 To 100
Z1 = ImgSub(Z, ImgLog(ImgDiv(X, Z)))
Z1 = ImgSub(setComplex(0, 0), Z1)

Z2 = ImgProduct(setComplex(2, 0), ImgDiv(Z1, setComplex(3, 0)))
Z2 = ImgSum(setComplex(1, 0), ImgSum(Z, Z2))
Z2 = ImgProduct(ImgSum(Z, setComplex(1, 0)), Z2)
Q1 = ImgProduct(setComplex(2, 0), Z2)

Z2 = ImgSub(Q1, ImgProduct(setComplex(2, 0), Z1))
Z2 = ImgDiv(ImgSub(Q1, Z1), Z2)

Z3 = ImgDiv(Z1, ImgSum(setComplex(1, 0), Z))

Z2 = ImgSum(setComplex(1, 0), ImgProduct(Z3, Z2))
Z1 = ImgProduct(Z, Z2)

If Z(0) = Z1(0) And Z(1) = Z1(1) Then
Exit For
Else
Z(0) = Z1(0): Z(1) = Z1(1)
End If

Next
End If

End If


Final: LambertWc = Z End Function

since no one seemed to be able to help i kept searching and found an answer, using the infinite tower of complex number's propriety : $z^{z^{z^{z^{.^{.^{.^{}}}}}}}=W(-ln(x))/(-ln(x))$.

So with that i can found $W_{0}(x)$ but i have no clue for how to find the complex $W_{-1}(x)$