function [dbieresult,x]=dbie(x);
dbieresult=[];
persistent atr bif2cs bifcs big2cs bigcs bip1cs bip2cs btr eta first firstCall nbif nbif2 nbig nbig2 nbip1 nbip2 sqrtx theta x32sml x3sml xbig xm 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;
if isempty(nbip1), nbip1=0; end;
if isempty(nbip2), nbip2=0; end;
%***BEGIN PROLOGUE DBIE
%***PURPOSE Calculate the Bairy function for a negative argument and an
% exponentially scaled Bairy function for a non-negative
% argument.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C10D
%***TYPE doubleprecision (BIE-S, DBIE-D)
%***KEYWORDS BAIRY FUNCTION, EXPONENTIALLY SCALED, FNLIB,
% SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% DBIE(X) calculates the doubleprecision Airy function of the
% second kind or the doubleprecision exponentially scaled Airy
% function of the second kind, depending on the value of the
% doubleprecision argument X.
%
% Evaluate BI(X) for X .LE. 0.0 and BI(X)*EXP(-ZETA) where
% ZETA = 2/3 * X**(3/2) for X .GE. 0.0
%
%
% 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
%
%
% Series for BIP1 on the interval 1.25000E-01 to 3.53553E-01
% with weighted error 1.06E-32
% log weighted error 31.98
% significant figures required 30.61
% decimal places required 32.81
%
%
% Series for BIP2 on the interval 0. to 1.25000E-01
% with weighted error 4.04E-33
% log weighted error 32.39
% significant figures required 31.15
% decimal places required 33.37
%
%***REFERENCES (NONE)
%***ROUTINES CALLED D1MACH, D9AIMP, DCSEVL, INITDS
%***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)
%***end PROLOGUE DBIE
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(bip1cs), bip1cs=zeros(1,47); end;
if isempty(bip2cs), bip2cs=zeros(1,88); end;
if isempty(atr), atr=0; end;
if isempty(btr), btr=0; end;
if isempty(sqrtx), sqrtx=0; end;
if isempty(theta), theta=0; end;
if isempty(xbig), xbig=0; end;
if isempty(xm), xm=0; end;
if isempty(x3sml), x3sml=0; end;
if isempty(x32sml), x32sml=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, bip1cs(1)=[-.83220474779434474687471864707973d-1]; end;
if firstCall, bip1cs(2)=[+.11461189273711742889920226128031d-1]; end;
if firstCall, bip1cs(3)=[+.42896440718911509494134472566635d-3]; end;
if firstCall, bip1cs(4)=[-.14906639379950514017847677732954d-3]; end;
if firstCall, bip1cs(5)=[-.13076597267876290663136340998881d-4]; end;
if firstCall, bip1cs(6)=[+.63275983961030344754535716032494d-5]; end;
if firstCall, bip1cs(7)=[-.42226696982681924884778515889433d-6]; end;
if firstCall, bip1cs(8)=[-.19147186298654689632835494181277d-6]; end;
if firstCall, bip1cs(9)=[+.64531062845583173611038157880934d-7]; end;
if firstCall, bip1cs(10)=[-.78448546771397719289748310448628d-8]; end;
if firstCall, bip1cs(11)=[-.96077216623785085879198533565432d-9]; end;
if firstCall, bip1cs(12)=[+.70004713316443966339006074402068d-9]; end;
if firstCall, bip1cs(13)=[-.17731789132814932022083128056698d-9]; end;
if firstCall, bip1cs(14)=[+.22720894783465236347282126389311d-10]; end;
if firstCall, bip1cs(15)=[+.16540456313972049847032860681891d-11]; end;
if firstCall, bip1cs(16)=[-.18517125559292316390755369896693d-11]; end;
if firstCall, bip1cs(17)=[+.59576312477117290165680715534277d-12]; end;
if firstCall, bip1cs(18)=[-.12194348147346564781055769498986d-12]; end;
if firstCall, bip1cs(19)=[+.13347869253513048815386347813597d-13]; end;
if firstCall, bip1cs(20)=[+.17278311524339746664384792889731d-14]; end;
if firstCall, bip1cs(21)=[-.14590732013016720735268871713166d-14]; end;
if firstCall, bip1cs(22)=[+.49010319927115819978994989520104d-15]; end;
if firstCall, bip1cs(23)=[-.11556545519261548129262972762521d-15]; end;
if firstCall, bip1cs(24)=[+.19098807367072411430671732441524d-16]; end;
if firstCall, bip1cs(25)=[-.11768966854492179886913995957862d-17]; end;
if firstCall, bip1cs(26)=[-.63271925149530064474537459677047d-18]; end;
if firstCall, bip1cs(27)=[+.33861838880715361614130191322316d-18]; end;
if firstCall, bip1cs(28)=[-.10725825321758625254992162219622d-18]; end;
if firstCall, bip1cs(29)=[+.25995709605617169284786933115562d-19]; end;
if firstCall, bip1cs(30)=[-.48477583571081193660962309494101d-20]; end;
if firstCall, bip1cs(31)=[+.55298913982121625361505513198933d-21]; end;
if firstCall, bip1cs(32)=[+.49421660826069471371748197444266d-22]; end;
if firstCall, bip1cs(33)=[-.55162121924145707458069720814933d-22]; end;
if firstCall, bip1cs(34)=[+.21437560417632550086631884499626d-22]; end;
if firstCall, bip1cs(35)=[-.61910313387655605798785061137066d-23]; end;
if firstCall, bip1cs(36)=[+.14629362707391245659830967336959d-23]; end;
if firstCall, bip1cs(37)=[-.27918484471059005576177866069333d-24]; end;
if firstCall, bip1cs(38)=[+.36455703168570246150906795349333d-25]; end;
if firstCall, bip1cs(39)=[+.58511821906188711839382459733333d-27]; end;
if firstCall, bip1cs(40)=[-.24946950487566510969745047551999d-26]; end;
if firstCall, bip1cs(41)=[+.10979323980338380977919579477333d-26]; end;
if firstCall, bip1cs(42)=[-.34743388345961115015034088106666d-27]; end;
if firstCall, bip1cs(43)=[+.91373402635349697363171082240000d-28]; end;
if firstCall, bip1cs(44)=[-.20510352728210629186247720959999d-28]; end;
if firstCall, bip1cs(45)=[+.37976985698546461748651622399999d-29]; end;
if firstCall, bip1cs(46)=[-.48479458497755565887848448000000d-30]; end;
if firstCall, bip1cs(47)=[-.10558306941230714314205866666666d-31]; end;
if firstCall, bip2cs(1)=[-.11359673758598867913797310895527d+0]; end;
if firstCall, bip2cs(2)=[+.41381473947881595760052081171444d-2]; end;
if firstCall, bip2cs(3)=[+.13534706221193329857696921727508d-3]; end;
if firstCall, bip2cs(4)=[+.10427316653015353405887183456780d-4]; end;
if firstCall, bip2cs(5)=[+.13474954767849907889589911958925d-5]; end;
if firstCall, bip2cs(6)=[+.16965374054383983356062511163756d-6]; end;
if firstCall, bip2cs(7)=[-.10096500865641624301366228396373d-7]; end;
if firstCall, bip2cs(8)=[-.16729119493778475127836973095943d-7]; end;
if firstCall, bip2cs(9)=[-.45815364485068383217152795613391d-8]; end;
if firstCall, bip2cs(10)=[+.37366813665655477274064749384284d-9]; end;
if firstCall, bip2cs(11)=[+.57669303201452448119584643502111d-9]; end;
if firstCall, bip2cs(12)=[+.62181265087850324095393408792371d-10]; end;
if firstCall, bip2cs(13)=[-.63294120282743068241589177281354d-10]; end;
if firstCall, bip2cs(14)=[-.14915047908598767633999091989487d-10]; end;
if firstCall, bip2cs(15)=[+.78896213942486771938172394294891d-11]; end;
if firstCall, bip2cs(16)=[+.24960513721857797984888064000127d-11]; end;
if firstCall, bip2cs(17)=[-.12130075287291659477746664734814d-11]; end;
if firstCall, bip2cs(18)=[-.37404939108727277887343460402716d-12]; end;
if firstCall, bip2cs(19)=[+.22377278140321476798783446931091d-12]; end;
if firstCall, bip2cs(20)=[+.47490296312192466341986077472514d-13]; end;
if firstCall, bip2cs(21)=[-.45261607991821224810605655831294d-13]; end;
if firstCall, bip2cs(22)=[-.30172271841986072645112245876020d-14]; end;
if firstCall, bip2cs(23)=[+.91058603558754058327592683478908d-14]; end;
if firstCall, bip2cs(24)=[-.98149238033807062926643864207709d-15]; end;
if firstCall, bip2cs(25)=[-.16429400647889465253601245251589d-14]; end;
if firstCall, bip2cs(26)=[+.55334834214274215451182114635164d-15]; end;
if firstCall, bip2cs(27)=[+.21750479864482655984374381998156d-15]; end;
if firstCall, bip2cs(28)=[-.17379236200220656971287029558087d-15]; end;
if firstCall, bip2cs(29)=[-.10470023471443714959283909313604d-17]; end;
if firstCall, bip2cs(30)=[+.39219145986056386925441403311462d-16]; end;
if firstCall, bip2cs(31)=[-.11621293686345196925824005665910d-16]; end;
if firstCall, bip2cs(32)=[-.54027474491754245533735411307773d-17]; end;
if firstCall, bip2cs(33)=[+.45441582123884610882675428553304d-17]; end;
if firstCall, bip2cs(34)=[-.28775599625221075729427585480086d-18]; end;
if firstCall, bip2cs(35)=[-.10017340927225341243596162960440d-17]; end;
if firstCall, bip2cs(36)=[+.44823931215068369856332561906313d-18]; end;
if firstCall, bip2cs(37)=[+.76135968654908942328948982366775d-19]; end;
if firstCall, bip2cs(38)=[-.14448324094881347238956060145422d-18]; end;
if firstCall, bip2cs(39)=[+.40460859449205362251624847392112d-19]; end;
if firstCall, bip2cs(40)=[+.20321085700338446891325190707277d-19]; end;
if firstCall, bip2cs(41)=[-.19602795471446798718272758041962d-19]; end;
if firstCall, bip2cs(42)=[+.34273038443944824263518958211738d-20]; end;
if firstCall, bip2cs(43)=[+.37023705853905135480024651593154d-20]; end;
if firstCall, bip2cs(44)=[-.26879595172041591131400332966712d-20]; end;
if firstCall, bip2cs(45)=[+.28121678463531712209714454683364d-21]; end;
if firstCall, bip2cs(46)=[+.60933963636177797173271119680329d-21]; end;
if firstCall, bip2cs(47)=[-.38666621897150844994172977893413d-21]; end;
if firstCall, bip2cs(48)=[+.25989331253566943450895651927228d-22]; end;
if firstCall, bip2cs(49)=[+.97194393622938503767281175216084d-22]; end;
if firstCall, bip2cs(50)=[-.59392817834375098415630478204591d-22]; end;
if firstCall, bip2cs(51)=[+.38864949977113015409591960439444d-23]; end;
if firstCall, bip2cs(52)=[+.15334307393617272869721512868769d-22]; end;
if firstCall, bip2cs(53)=[-.97513555209762624036336521409724d-23]; end;
if firstCall, bip2cs(54)=[+.96340644440489471424741339383726d-24]; end;
if firstCall, bip2cs(55)=[+.23841999400208880109946748792454d-23]; end;
if firstCall, bip2cs(56)=[-.16896986315019706184848044205207d-23]; end;
if firstCall, bip2cs(57)=[+.27352715888928361222578444801478d-24]; end;
if firstCall, bip2cs(58)=[+.35660016185409578960111685025730d-24]; end;
if firstCall, bip2cs(59)=[-.30234026608258827249534280666954d-24]; end;
if firstCall, bip2cs(60)=[+.75002041605973930653144204823232d-25]; end;
if firstCall, bip2cs(61)=[+.48403287575851388827455319838748d-25]; end;
if firstCall, bip2cs(62)=[-.54364137654447888432698010297766d-25]; end;
if firstCall, bip2cs(63)=[+.19281214470820962653345978809756d-25]; end;
if firstCall, bip2cs(64)=[+.50116355020532656659611814172172d-26]; end;
if firstCall, bip2cs(65)=[-.95040744582693253786034620869972d-26]; end;
if firstCall, bip2cs(66)=[+.46372646157101975948696332245611d-26]; end;
if firstCall, bip2cs(67)=[+.21177170704466954163768170577046d-28]; end;
if firstCall, bip2cs(68)=[-.15404850268168594303692204548726d-26]; end;
if firstCall, bip2cs(69)=[+.10387944293201213662047889194441d-26]; end;
if firstCall, bip2cs(70)=[-.19890078156915416751316728235153d-27]; end;
if firstCall, bip2cs(71)=[-.21022173878658495471177044522532d-27]; end;
if firstCall, bip2cs(72)=[+.21353099724525793150633356670491d-27]; end;
if firstCall, bip2cs(73)=[-.79040810747961342319023537632627d-28]; end;
if firstCall, bip2cs(74)=[-.16575359960435585049973741763592d-28]; end;
if firstCall, bip2cs(75)=[+.38868342850124112587625586496537d-28]; end;
if firstCall, bip2cs(76)=[-.22309237330896866182621562424717d-28]; end;
if firstCall, bip2cs(77)=[+.27777244420176260265625977404382d-29]; end;
if firstCall, bip2cs(78)=[+.57078543472657725368712433782772d-29]; end;
if firstCall, bip2cs(79)=[-.51743084445303852800173371555280d-29]; end;
if firstCall, bip2cs(80)=[+.18413280751095837198450927071569d-29]; end;
if firstCall, bip2cs(81)=[+.44422562390957094598544071068647d-30]; end;
if firstCall, bip2cs(82)=[-.98504142639629801547464958226943d-30]; end;
if firstCall, bip2cs(83)=[+.58857201353585104884754198881995d-30]; end;
if firstCall, bip2cs(84)=[-.97636075440429787961402312628595d-31]; end;
if firstCall, bip2cs(85)=[-.13581011996074695047063597884122d-30]; end;
if firstCall, bip2cs(86)=[+.13999743518492413270568048380345d-30]; end;
if firstCall, bip2cs(87)=[-.59754904545248477620884562981118d-31]; end;
if firstCall, bip2cs(88)=[-.40391653875428313641045327529856d-32]; end;
if firstCall, atr=[8.75069057084843450880771988210148d0]; end;
if firstCall, btr=[-2.09383632135605431360096498526268d0]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT DBIE
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);
[nbip1 ,bip1cs,dumvar3,eta]=initds(bip1cs,47,eta);
[nbip2 ,bip2cs,dumvar3,eta]=initds(bip2cs,88,eta);
%
x3sml = eta.^0.3333;
x32sml = 1.3104d0.*x3sml.^2;
xbig = d1mach(2).^0.6666d0;
end;
first = false;
%
if( x<(-1.0d0) )
[x,xm,theta]=d9aimp(x,xm,theta);
dbieresult = 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;
dbieresult = 0.625d0 + dcsevl(z,bifcs,nbif)+ x.*(0.4375d0+dcsevl(z,bigcs,nbig));
if( x>x32sml )
dbieresult = dbieresult.*exp(-2.0d0.*x.*sqrt(x)./3.0d0);
end;
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 ) ;
z =(2.0d0.*x.^3-9.0d0)./7.0d0;
dbieresult = exp(-2.0d0.*x.*sqrt(x)./3.0d0).*(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;
%
elseif( x>4.0d0 ) ;
%
sqrtx = sqrt(x);
z = -1.0d0;
if( x<xbig )
z = 16.0d0./(x.*sqrtx) - 1.0d0;
end;
dbieresult =(0.625d0+dcsevl(z,bip2cs,nbip2))./sqrt(sqrtx);
else;
sqrtx = sqrt(x);
z = atr./(x.*sqrtx) + btr;
dbieresult =(0.625d0+dcsevl(z,bip1cs,nbip1))./sqrt(sqrtx);
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 DBI