function [besy0result,x]=besy0(x);
besy0result=[];
persistent ampl besy0 bm0cs bth0cs by0cs first firstCall ntm0 ntth0 nty0 pi4 theta twodpi xmax xsml y z ; if isempty(firstCall),firstCall=1;end;
if isempty(ampl), ampl=0; end;
if isempty(besy0result), besy0result=0; end;
if isempty(bm0cs), bm0cs=zeros(1,21); end;
if isempty(bth0cs), bth0cs=zeros(1,24); end;
if isempty(by0cs), by0cs=zeros(1,13); end;
if isempty(pi4), pi4=0; end;
if isempty(theta), theta=0; end;
if isempty(twodpi), twodpi=0; end;
if isempty(xmax), xmax=0; end;
if isempty(xsml), xsml=0; end;
if isempty(y), y=0; end;
if isempty(z), z=0; end;
if isempty(ntm0), ntm0=0; end;
if isempty(ntth0), ntth0=0; end;
if isempty(nty0), nty0=0; end;
%***BEGIN PROLOGUE BESY0
%***PURPOSE Compute the Bessel function of the second kind of order
% zero.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C10A1
%***TYPE SINGLE PRECISION (BESY0-S, DBESY0-D)
%***KEYWORDS BESSEL FUNCTION, FNLIB, ORDER ZERO, SECOND KIND,
% SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% BESY0(X) calculates the Bessel function of the second kind
% of order zero for real argument X.
%
% Series for BY0 on the interval 0. to 1.60000D+01
% with weighted error 1.20E-17
% log weighted error 16.92
% significant figures required 16.15
% decimal places required 17.48
%
% Series for BM0 on the interval 0. to 6.25000D-02
% with weighted error 4.98E-17
% log weighted error 16.30
% significant figures required 14.97
% decimal places required 16.96
%
% Series for BTH0 on the interval 0. to 6.25000D-02
% with weighted error 3.67E-17
% log weighted error 16.44
% significant figures required 15.53
% decimal places required 17.13
%
%***REFERENCES (NONE)
%***ROUTINES CALLED BESJ0, CSEVL, INITS, R1MACH, XERMSG
%***REVISION HISTORY (YYMMDD)
% 770401 DATE WRITTEN
% 890531 Changed all specific intrinsics to generic. (WRB)
% 890531 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
% 900326 Removed duplicate information from DESCRIPTION section.
% (WRB)
%***end PROLOGUE BESY0
if isempty(first), first=false; end;
if firstCall, by0cs(1)=[-.011277839392865573e0]; end;
if firstCall, by0cs(2)=[-.12834523756042035e0]; end;
if firstCall, by0cs(3)=[-.10437884799794249e0]; end;
if firstCall, by0cs(4)=[.023662749183969695e0]; end;
if firstCall, by0cs(5)=[-.002090391647700486e0]; end;
if firstCall, by0cs(6)=[.000103975453939057e0]; end;
if firstCall, by0cs(7)=[-.000003369747162423e0]; end;
if firstCall, by0cs(8)=[.000000077293842676e0]; end;
if firstCall, by0cs(9)=[-.000000001324976772e0]; end;
if firstCall, by0cs(10)=[.000000000017648232e0]; end;
if firstCall, by0cs(11)=[-.000000000000188105e0]; end;
if firstCall, by0cs(12)=[.000000000000001641e0]; end;
if firstCall, by0cs(13)=[-.000000000000000011e0]; end;
if firstCall, bm0cs(1)=[.09284961637381644e0]; end;
if firstCall, bm0cs(2)=[-.00142987707403484e0]; end;
if firstCall, bm0cs(3)=[.00002830579271257e0]; end;
if firstCall, bm0cs(4)=[-.00000143300611424e0]; end;
if firstCall, bm0cs(5)=[.00000012028628046e0]; end;
if firstCall, bm0cs(6)=[-.00000001397113013e0]; end;
if firstCall, bm0cs(7)=[.00000000204076188e0]; end;
if firstCall, bm0cs(8)=[-.00000000035399669e0]; end;
if firstCall, bm0cs(9)=[.00000000007024759e0]; end;
if firstCall, bm0cs(10)=[-.00000000001554107e0]; end;
if firstCall, bm0cs(11)=[.00000000000376226e0]; end;
if firstCall, bm0cs(12)=[-.00000000000098282e0]; end;
if firstCall, bm0cs(13)=[.00000000000027408e0]; end;
if firstCall, bm0cs(14)=[-.00000000000008091e0]; end;
if firstCall, bm0cs(15)=[.00000000000002511e0]; end;
if firstCall, bm0cs(16)=[-.00000000000000814e0]; end;
if firstCall, bm0cs(17)=[.00000000000000275e0]; end;
if firstCall, bm0cs(18)=[-.00000000000000096e0]; end;
if firstCall, bm0cs(19)=[.00000000000000034e0]; end;
if firstCall, bm0cs(20)=[-.00000000000000012e0]; end;
if firstCall, bm0cs(21)=[.00000000000000004e0]; end;
if firstCall, bth0cs(1)=[-.24639163774300119e0]; end;
if firstCall, bth0cs(2)=[.001737098307508963e0]; end;
if firstCall, bth0cs(3)=[-.000062183633402968e0]; end;
if firstCall, bth0cs(4)=[.000004368050165742e0]; end;
if firstCall, bth0cs(5)=[-.000000456093019869e0]; end;
if firstCall, bth0cs(6)=[.000000062197400101e0]; end;
if firstCall, bth0cs(7)=[-.000000010300442889e0]; end;
if firstCall, bth0cs(8)=[.000000001979526776e0]; end;
if firstCall, bth0cs(9)=[-.000000000428198396e0]; end;
if firstCall, bth0cs(10)=[.000000000102035840e0]; end;
if firstCall, bth0cs(11)=[-.000000000026363898e0]; end;
if firstCall, bth0cs(12)=[.000000000007297935e0]; end;
if firstCall, bth0cs(13)=[-.000000000002144188e0]; end;
if firstCall, bth0cs(14)=[.000000000000663693e0]; end;
if firstCall, bth0cs(15)=[-.000000000000215126e0]; end;
if firstCall, bth0cs(16)=[.000000000000072659e0]; end;
if firstCall, bth0cs(17)=[-.000000000000025465e0]; end;
if firstCall, bth0cs(18)=[.000000000000009229e0]; end;
if firstCall, bth0cs(19)=[-.000000000000003448e0]; end;
if firstCall, bth0cs(20)=[.000000000000001325e0]; end;
if firstCall, bth0cs(21)=[-.000000000000000522e0]; end;
if firstCall, bth0cs(22)=[.000000000000000210e0]; end;
if firstCall, bth0cs(23)=[-.000000000000000087e0]; end;
if firstCall, bth0cs(24)=[.000000000000000036e0]; end;
if firstCall, twodpi=[0.63661977236758134e0]; end;
if firstCall, pi4=[0.78539816339744831e0]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT BESY0
if( first )
[nty0 ,by0cs]=inits(by0cs,13,0.1.*r1mach(3));
[ntm0 ,bm0cs]=inits(bm0cs,21,0.1.*r1mach(3));
[ntth0 ,bth0cs]=inits(bth0cs,24,0.1.*r1mach(3));
%
xsml = sqrt(4.0.*r1mach(3));
xmax = 1.0./r1mach(4);
end;
first = false;
%
if( x<=0. )
xermsg('SLATEC','BESY0','X IS ZERO OR NEGATIVE',1,2);
end;
if( x>4.0 )
%
if( x>xmax )
xermsg('SLATEC','BESY0','NO PRECISION BECAUSE X IS BIG',2,2);
end;
%
z = 32.0./x.^2 - 1.0;
ampl =(0.75+csevl(z,bm0cs,ntm0))./sqrt(x);
theta = x - pi4 + csevl(z,bth0cs,ntth0)./x;
besy0result = ampl.*sin(theta);
else;
%
y = 0.;
if( x>xsml )
y = x.*x;
end;
besy0result = twodpi.*log(0.5.*x).*besj0(x)+ .375 + csevl(.125.*y-1.,by0cs,nty0);
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
end;
%
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
end
%DECK BESY1