%SWOFY1 Symbolic version of wofy1.m % function [w,it]=swofy1(dig,y) % % The following increment of dig depends on % the distance of y from -exp(-1); if that % distance is 10^(-5), 10^(-10), or 10^(-20), % then the increment should be respectively % 4, 7, and 12. % digits(dig+4); y=vpa(y); if subs(y+exp(-vpa(1)))<0 | subs(y)>=0 error('y out of range') return end eps0=.5*10^(-dig); w1=vpa(-2); w0=vpa(1); diff0=1; it=0; while abs(diff0)>eps0 it=it+1; if it>100 error('divergence in swofy1') break end w0=w1; w1=vpa((w0*w0+y*exp(-vpa(w0)))/(vpa(1)+w0)); diff=w1-w0; diff0=subs(diff); end w=vpa(w1,dig);