function [dbiresult,x]=dbi(x);
dbiresult=[];
persistent bif2cs bifcs big2cs bigcs eta first firstCall nbif nbif2 nbig nbig2 theta x3sml xm xmax z ; if isempty(firstCall),firstCall=1;end;
;
if isempty(eta), eta=0; end;
if isempty(nbif), nbif=0; end;
if isempty(nbif2), nbif2=0; end;
if isempty(nbig), nbig=0; end;
if isempty(nbig2), nbig2=0; end;
%***BEGIN PROLOGUE DBI
%***PURPOSE Evaluate the Bairy function (the Airy function of the
% second kind).
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C10D
%***TYPE doubleprecision (BI-S, DBI-D)
%***KEYWORDS BAIRY FUNCTION, FNLIB, SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% DBI(X) calculates the doubleprecision Airy function of the
% second kind for doubleprecision argument X.
%
% Series for BIF on the interval -1.00000E+00 to 1.00000E+00
% with weighted error 1.45E-32
% log weighted error 31.84
% significant figures required 30.85
% decimal places required 32.40
%
% Series for BIG on the interval -1.00000E+00 to 1.00000E+00
% with weighted error 1.29E-33
% log weighted error 32.89
% significant figures required 31.48
% decimal places required 33.45
%
% Series for BIF2 on the interval 1.00000E+00 to 8.00000E+00
% with weighted error 6.08E-32
% log weighted error 31.22
% approx significant figures required 30.8
% decimal places required 31.80
%
% Series for BIG2 on the interval 1.00000E+00 to 8.00000E+00
% with weighted error 4.91E-33
% log weighted error 32.31
% approx significant figures required 31.6
% decimal places required 32.90
%
%***REFERENCES (NONE)
%***ROUTINES CALLED D1MACH, D9AIMP, DBIE, DCSEVL, INITDS, XERMSG
%***REVISION HISTORY (YYMMDD)
% 770701 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)
%***end PROLOGUE DBI
if isempty(bifcs), bifcs=zeros(1,13); end;
if isempty(bigcs), bigcs=zeros(1,13); end;
if isempty(bif2cs), bif2cs=zeros(1,15); end;
if isempty(big2cs), big2cs=zeros(1,15); end;
if isempty(theta), theta=0; end;
if isempty(xm), xm=0; end;
if isempty(xmax), xmax=0; end;
if isempty(x3sml), x3sml=0; end;
if isempty(z), z=0; end;
if isempty(first), first=false; end;
if firstCall, bifcs(1)=[-.16730216471986649483537423928176d-1]; end;
if firstCall, bifcs(2)=[+.10252335834249445611426362777757d+0]; end;
if firstCall, bifcs(3)=[+.17083092507381516539429650242013d-2]; end;
if firstCall, bifcs(4)=[+.11862545467744681179216459210040d-4]; end;
if firstCall, bifcs(5)=[+.44932907017792133694531887927242d-7]; end;
if firstCall, bifcs(6)=[+.10698207143387889067567767663628d-9]; end;
if firstCall, bifcs(7)=[+.17480643399771824706010517628573d-12]; end;
if firstCall, bifcs(8)=[+.20810231071761711025881891834399d-15]; end;
if firstCall, bifcs(9)=[+.18849814695665416509927971733333d-18]; end;
if firstCall, bifcs(10)=[+.13425779173097804625882666666666d-21]; end;
if firstCall, bifcs(11)=[+.77159593429658887893333333333333d-25]; end;
if firstCall, bifcs(12)=[+.36533879617478566399999999999999d-28]; end;
if firstCall, bifcs(13)=[+.14497565927953066666666666666666d-31]; end;
if firstCall, bigcs(1)=[+.22466223248574522283468220139024d-1]; end;
if firstCall, bigcs(2)=[+.37364775453019545441727561666752d-1]; end;
if firstCall, bigcs(3)=[+.44476218957212285696215294326639d-3]; end;
if firstCall, bigcs(4)=[+.24708075636329384245494591948882d-5]; end;
if firstCall, bigcs(5)=[+.79191353395149635134862426285596d-8]; end;
if firstCall, bigcs(6)=[+.16498079851827779880887872402706d-10]; end;
if firstCall, bigcs(7)=[+.24119906664835455909247501122841d-13]; end;
if firstCall, bigcs(8)=[+.26103736236091436985184781269333d-16]; end;
if firstCall, bigcs(9)=[+.21753082977160323853123792000000d-19]; end;
if firstCall, bigcs(10)=[+.14386946400390433219483733333333d-22]; end;
if firstCall, bigcs(11)=[+.77349125612083468629333333333333d-26]; end;
if firstCall, bigcs(12)=[+.34469292033849002666666666666666d-29]; end;
if firstCall, bigcs(13)=[+.12938919273216000000000000000000d-32]; end;
if firstCall, bif2cs(1)=[+.0998457269381604104468284257993d+0]; end;
if firstCall, bif2cs(2)=[+.47862497786300553772211467318231d+0]; end;
if firstCall, bif2cs(3)=[+.25155211960433011771324415436675d-1]; end;
if firstCall, bif2cs(4)=[+.58206938852326456396515697872216d-3]; end;
if firstCall, bif2cs(5)=[+.74997659644377865943861457378217d-5]; end;
if firstCall, bif2cs(6)=[+.61346028703493836681403010356474d-7]; end;
if firstCall, bif2cs(7)=[+.34627538851480632900434268733359d-9]; end;
if firstCall, bif2cs(8)=[+.14288910080270254287770846748931d-11]; end;
if firstCall, bif2cs(9)=[+.44962704298334641895056472179200d-14]; end;
if firstCall, bif2cs(10)=[+.11142323065833011708428300106666d-16]; end;
if firstCall, bif2cs(11)=[+.22304791066175002081517866666666d-19]; end;
if firstCall, bif2cs(12)=[+.36815778736393142842922666666666d-22]; end;
if firstCall, bif2cs(13)=[+.50960868449338261333333333333333d-25]; end;
if firstCall, bif2cs(14)=[+.60003386926288554666666666666666d-28]; end;
if firstCall, bif2cs(15)=[+.60827497446570666666666666666666d-31]; end;
if firstCall, big2cs(1)=[+.033305662145514340465176188111647d+0]; end;
if firstCall, big2cs(2)=[+.161309215123197067613287532084943d+0]; end;
if firstCall, big2cs(3)=[+.631900730961342869121615634921173d-2]; end;
if firstCall, big2cs(4)=[+.118790456816251736389780192304567d-3]; end;
if firstCall, big2cs(5)=[+.130453458862002656147116485012843d-5]; end;
if firstCall, big2cs(6)=[+.937412599553521729546809615508936d-8]; end;
if firstCall, big2cs(7)=[+.474580188674725153788510169834595d-10]; end;
if firstCall, big2cs(8)=[+.178310726509481399800065667560946d-12]; end;
if firstCall, big2cs(9)=[+.516759192784958180374276356640000d-15]; end;
if firstCall, big2cs(10)=[+.119004508386827125129496251733333d-17]; end;
if firstCall, big2cs(11)=[+.222982880666403517277063466666666d-20]; end;
if firstCall, big2cs(12)=[+.346551923027689419722666666666666d-23]; end;
if firstCall, big2cs(13)=[+.453926336320504514133333333333333d-26]; end;
if firstCall, big2cs(14)=[+.507884996513522346666666666666666d-29]; end;
if firstCall, big2cs(15)=[+.491020674696533333333333333333333d-32]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT DBI
if( first )
eta = 0.1.*real(d1mach(3));
[nbif ,bifcs,dumvar3,eta]=initds(bifcs,13,eta);
[nbig ,bigcs,dumvar3,eta]=initds(bigcs,13,eta);
[nbif2 ,bif2cs,dumvar3,eta]=initds(bif2cs,15,eta);
[nbig2 ,big2cs,dumvar3,eta]=initds(big2cs,15,eta);
%
x3sml = eta.^0.3333;
xmax =(1.5.*log(d1mach(2))).^0.6666d0;
end;
first = false;
%
if( x<(-1.0d0) )
[x,xm,theta]=d9aimp(x,xm,theta);
dbiresult = xm.*sin(theta);
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x<=1.0d0 ) ;
z = 0.0d0;
if( abs(x)>x3sml )
z = x.^3;
end;
dbiresult = 0.625 + dcsevl(z,bifcs,nbif)+ x.*(0.4375d0+dcsevl(z,bigcs,nbig));
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
%
elseif( x>2.0d0 ) ;
%
if( x>xmax )
xermsg('SLATEC','DBI','X SO BIG THAT BI OVERFLOWS',1,2);
end;
%
dbiresult = dbie(x).*exp(2.0d0.*x.*sqrt(x)./3.0d0);
else;
z =(2.0d0.*x.^3-9.0d0)./7.0d0;
dbiresult = 1.125d0 + dcsevl(z,bif2cs,nbif2)+ x.*(0.625d0+dcsevl(z,big2cs,nbig2));
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 DBINOM