%WOFWY1 The Lambert function w_{-1}(y) for -1/e\leq y<0 % function w=wofy1(y) if y<-1/exp(1) | y>=0 error('y out of range') end if y+1/exp(1)>.5e-4 it=0; w1=-2; w0=0; while abs(w1-w0)>10^4*eps it=it+1; w0=w1; w1=(w0^2+y*exp(-w0))/(1+w0); end w=w1; err=abs((w*exp(w)-y)/y); else e=exp(1); x=sqrt(y+1/e); c1=-sqrt(2*e); c2=-2*e/3; c3=-11*sqrt(2)*e^(3/2)/36; c4=-43*e^2/135; c5=-769*sqrt(2)*e^(5/2)/4320; c6=-1768*e^3/8505; w=-1+c1*x+c2*x^2+c3*x^3+c4*x^4+c5*x^5+c6*x^6; end