46 INTEGER,
INTENT(IN) :: K
47 REAL(KIND=KIND(1.0d0)),
INTENT(IN) :: X
48 REAL(KIND=KIND(1.0d0)),
INTENT(OUT) :: W
50 INTEGER :: I,J,Q,R,Q2,Q3
52 REAL(KIND=KIND(1.0d0)),
PARAMETER :: EPS=4.0E-16
53 REAL(KIND=KIND(1.0d0)),
PARAMETER :: EM1=0.3678794411714423215955237701614608
55 REAL(KIND=KIND(1.0d0)) :: PP,EE,TT2,L1,L2
59 print*,
'Lambert W-Function: Bad Argument! STOP!'
66 IF(x<(-em1+1e-4))
THEN
72 & +2.331643981597124203363536062168*r &
73 & -1.812187885639363490240191647568*q &
74 & +1.936631114492359755363277457668*r*q &
75 & -2.353551201881614516821543561516*q2 &
76 & +3.066858901050631912893148922704*r*q2 &
77 & -4.175335600258177138854984177460*q3 &
78 & +5.858023729874774148815053846119*r*q3 &
79 & -8.401032217523977370984161688514*q3*q
83 pp=sqrt(2.0*(2.7182818284590452353602874713526625*x+1.0))
84 w=-1.0+pp*(1.0+pp*(-0.333333333333333333333+pp*0.152777777777777777777777))
94 DO WHILE (abs(tt2)>(eps*(1.0+abs(w))))
100 tt2=tt2/(ee*pp-0.5*(pp+1.0)*tt2/pp)
123 pp=-sqrt(2.0*(2.7182818284590452353602874713526625*x+1.0))
124 w=-1.0+pp*(1.0+pp*(-0.333333333333333333333+pp*0.152777777777777777777777))
130 IF(abs(pp)<1e-4)
THEN
135 DO WHILE(abs(tt2)>eps*(1.0+abs(w)))
141 tt2=tt2/(ee*pp-0.5*(pp+1.0)*tt2/pp)
152 print*,
"Lambert W-Function Branch Should Be -1 OR 0!"
subroutine lambertw(K, X, W)
subroutine to implement the lambertw function see https://en.wikipedia.org/wiki/Lambert_W_function ...