function [daieresult,x]=daie(x);
daieresult=[];
persistent aifcs aigcs aip1cs aip2cs eta first firstCall naif naig naip1 naip2 sqrtx theta x32sml x3sml xbig xm z ; if isempty(firstCall),firstCall=1;end;
;
if isempty(eta), eta=0; end;
if isempty(naif), naif=0; end;
if isempty(naig), naig=0; end;
if isempty(naip1), naip1=0; end;
if isempty(naip2), naip2=0; end;
%***BEGIN PROLOGUE DAIE
%***PURPOSE Calculate the Airy function for a negative argument and an
% exponentially scaled Airy function for a non-negative
% argument.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C10D
%***TYPE doubleprecision (AIE-S, DAIE-D)
%***KEYWORDS EXPONENTIALLY SCALED AIRY FUNCTION, FNLIB,
% SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% DAIE(X) calculates the Airy function or the exponentially scaled
% Airy function depending on the value of the argument. The function
% and argument are both doubleprecision.
%
% Evaluate AI(X) for X .LE. 0.0 and AI(X)*EXP(ZETA) where
% ZETA = 2/3 * X**(3/2) for X .GE. 0.0
%
% Series for AIF on the interval -1.00000E+00 to 1.00000E+00
% with weighted error 8.37E-33
% log weighted error 32.08
% significant figures required 30.87
% decimal places required 32.63
%
% Series for AIG on the interval -1.00000E+00 to 1.00000E+00
% with weighted error 7.47E-34
% log weighted error 33.13
% significant figures required 31.50
% decimal places required 33.68
%
% Series for AIP1 on the interval 1.25000E-01 to 1.00000E+00
% with weighted error 3.69E-32
% log weighted error 31.43
% significant figures required 29.55
% decimal places required 32.31
%
% Series for AIP2 on the interval 0. to 1.25000E-01
% with weighted error 3.48E-32
% log weighted error 31.46
% significant figures required 28.74
% decimal places required 32.24
%
%***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)
% 920618 Removed space from variable names. (RWC, WRB)
%***end PROLOGUE DAIE
if isempty(aifcs), aifcs=zeros(1,13); end;
if isempty(aigcs), aigcs=zeros(1,13); end;
if isempty(aip1cs), aip1cs=zeros(1,57); end;
if isempty(aip2cs), aip2cs=zeros(1,37); 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, aifcs(1)=[-.37971358496669997496197089469414d-1]; end;
if firstCall, aifcs(2)=[+.59191888537263638574319728013777d-1]; end;
if firstCall, aifcs(3)=[+.98629280577279975365603891044060d-3]; end;
if firstCall, aifcs(4)=[+.68488438190765667554854830182412d-5]; end;
if firstCall, aifcs(5)=[+.25942025962194713019489279081403d-7]; end;
if firstCall, aifcs(6)=[+.61766127740813750329445749697236d-10]; end;
if firstCall, aifcs(7)=[+.10092454172466117901429556224601d-12]; end;
if firstCall, aifcs(8)=[+.12014792511179938141288033225333d-15]; end;
if firstCall, aifcs(9)=[+.10882945588716991878525295466666d-18]; end;
if firstCall, aifcs(10)=[+.77513772196684887039238400000000d-22]; end;
if firstCall, aifcs(11)=[+.44548112037175638391466666666666d-25]; end;
if firstCall, aifcs(12)=[+.21092845231692343466666666666666d-28]; end;
if firstCall, aifcs(13)=[+.83701735910741333333333333333333d-32]; end;
if firstCall, aigcs(1)=[+.18152365581161273011556209957864d-1]; end;
if firstCall, aigcs(2)=[+.21572563166010755534030638819968d-1]; end;
if firstCall, aigcs(3)=[+.25678356987483249659052428090133d-3]; end;
if firstCall, aigcs(4)=[+.14265214119792403898829496921721d-5]; end;
if firstCall, aigcs(5)=[+.45721149200180426070434097558191d-8]; end;
if firstCall, aigcs(6)=[+.95251708435647098607392278840592d-11]; end;
if firstCall, aigcs(7)=[+.13925634605771399051150420686190d-13]; end;
if firstCall, aigcs(8)=[+.15070999142762379592306991138666d-16]; end;
if firstCall, aigcs(9)=[+.12559148312567778822703205333333d-19]; end;
if firstCall, aigcs(10)=[+.83063073770821340343829333333333d-23]; end;
if firstCall, aigcs(11)=[+.44657538493718567445333333333333d-26]; end;
if firstCall, aigcs(12)=[+.19900855034518869333333333333333d-29]; end;
if firstCall, aigcs(13)=[+.74702885256533333333333333333333d-33]; end;
if firstCall, aip1cs(1)=[-.2146951858910538455460863467778d-1]; end;
if firstCall, aip1cs(2)=[-.7535382535043301166219720865565d-2]; end;
if firstCall, aip1cs(3)=[+.5971527949026380852035388881994d-3]; end;
if firstCall, aip1cs(4)=[-.7283251254207610648502368291548d-4]; end;
if firstCall, aip1cs(5)=[+.1110297130739299666517381821140d-4]; end;
if firstCall, aip1cs(6)=[-.1950386152284405710346930314033d-5]; end;
if firstCall, aip1cs(7)=[+.3786973885159515193885319670057d-6]; end;
if firstCall, aip1cs(8)=[-.7929675297350978279039072879154d-7]; end;
if firstCall, aip1cs(9)=[+.1762247638674256075568420122202d-7]; end;
if firstCall, aip1cs(10)=[-.4110767539667195045029896593893d-8]; end;
if firstCall, aip1cs(11)=[+.9984770057857892247183414107544d-9]; end;
if firstCall, aip1cs(12)=[-.2510093251387122211349867730034d-9]; end;
if firstCall, aip1cs(13)=[+.6500501929860695409272038601725d-10]; end;
if firstCall, aip1cs(14)=[-.1727818405393616515478877107366d-10]; end;
if firstCall, aip1cs(15)=[+.4699378842824512578362292872307d-11]; end;
if firstCall, aip1cs(16)=[-.1304675656297743914491241246272d-11]; end;
if firstCall, aip1cs(17)=[+.3689698478462678810473948382282d-12]; end;
if firstCall, aip1cs(18)=[-.1061087206646806173650359679035d-12]; end;
if firstCall, aip1cs(19)=[+.3098414384878187438660210070110d-13]; end;
if firstCall, aip1cs(20)=[-.9174908079824139307833423547851d-14]; end;
if firstCall, aip1cs(21)=[+.2752049140347210895693579062271d-14]; end;
if firstCall, aip1cs(22)=[-.8353750115922046558091393301880d-15]; end;
if firstCall, aip1cs(23)=[+.2563931129357934947568636168612d-15]; end;
if firstCall, aip1cs(24)=[-.7950633762598854983273747289822d-16]; end;
if firstCall, aip1cs(25)=[+.2489283634603069977437281175644d-16]; end;
if firstCall, aip1cs(26)=[-.7864326933928735569664626221296d-17]; end;
if firstCall, aip1cs(27)=[+.2505687311439975672324470645019d-17]; end;
if firstCall, aip1cs(28)=[-.8047420364163909524537958682241d-18]; end;
if firstCall, aip1cs(29)=[+.2604097118952053964443401104392d-18]; end;
if firstCall, aip1cs(30)=[-.8486954164056412259482488834184d-19]; end;
if firstCall, aip1cs(31)=[+.2784706882142337843359429186027d-19]; end;
if firstCall, aip1cs(32)=[-.9195858953498612913687224151354d-20]; end;
if firstCall, aip1cs(33)=[+.3055304318374238742247668225583d-20]; end;
if firstCall, aip1cs(34)=[-.1021035455479477875902177048439d-20]; end;
if firstCall, aip1cs(35)=[+.3431118190743757844000555680836d-21]; end;
if firstCall, aip1cs(36)=[-.1159129341797749513376922463109d-21]; end;
if firstCall, aip1cs(37)=[+.3935772844200255610836268229154d-22]; end;
if firstCall, aip1cs(38)=[-.1342880980296717611956718989038d-22]; end;
if firstCall, aip1cs(39)=[+.4603287883520002741659190305314d-23]; end;
if firstCall, aip1cs(40)=[-.1585043927004064227810772499387d-23]; end;
if firstCall, aip1cs(41)=[+.5481275667729675908925523755008d-24]; end;
if firstCall, aip1cs(42)=[-.1903349371855047259064017948945d-24]; end;
if firstCall, aip1cs(43)=[+.6635682302374008716777612115968d-25]; end;
if firstCall, aip1cs(44)=[-.2322311650026314307975200986453d-25]; end;
if firstCall, aip1cs(45)=[+.8157640113429179313142743695359d-26]; end;
if firstCall, aip1cs(46)=[-.2875824240632900490057489929557d-26]; end;
if firstCall, aip1cs(47)=[+.1017329450942901435079714319018d-26]; end;
if firstCall, aip1cs(48)=[-.3610879108742216446575703490559d-27]; end;
if firstCall, aip1cs(49)=[+.1285788540363993421256640342698d-27]; end;
if firstCall, aip1cs(50)=[-.4592901037378547425160693022719d-28]; end;
if firstCall, aip1cs(51)=[+.1645597033820713725812102485333d-28]; end;
if firstCall, aip1cs(52)=[-.5913421299843501842087920271360d-29]; end;
if firstCall, aip1cs(53)=[+.2131057006604993303479369509546d-29]; end;
if firstCall, aip1cs(54)=[-.7701158157787598216982761745066d-30]; end;
if firstCall, aip1cs(55)=[+.2790533307968930417581783777280d-30]; end;
if firstCall, aip1cs(56)=[-.1013807715111284006452241367039d-30]; end;
if firstCall, aip1cs(57)=[+.3692580158719624093658286216533d-31]; end;
if firstCall, aip2cs(1)=[-.174314496929375513390355844011d-2]; end;
if firstCall, aip2cs(2)=[-.167893854325541671632190613480d-2]; end;
if firstCall, aip2cs(3)=[+.359653403352166035885983858114d-4]; end;
if firstCall, aip2cs(4)=[-.138081860273922835457399383100d-5]; end;
if firstCall, aip2cs(5)=[+.741122807731505298848699095233d-7]; end;
if firstCall, aip2cs(6)=[-.500238203900133013130422866325d-8]; end;
if firstCall, aip2cs(7)=[+.400693917417184240675446866355d-9]; end;
if firstCall, aip2cs(8)=[-.367331242795905044199318496207d-10]; end;
if firstCall, aip2cs(9)=[+.376034439592373852439592002918d-11]; end;
if firstCall, aip2cs(10)=[-.422321332718747538026564938968d-12]; end;
if firstCall, aip2cs(11)=[+.513509454033657070919618754120d-13]; end;
if firstCall, aip2cs(12)=[-.669095850390477595651681356676d-14]; end;
if firstCall, aip2cs(13)=[+.926667545641290648239550724382d-15]; end;
if firstCall, aip2cs(14)=[-.135514382416070576333397356591d-15]; end;
if firstCall, aip2cs(15)=[+.208115496312830995299006549335d-16]; end;
if firstCall, aip2cs(16)=[-.334116499159176856871277570256d-17]; end;
if firstCall, aip2cs(17)=[+.558578584585924316868032946585d-18]; end;
if firstCall, aip2cs(18)=[-.969219040152365247518658209109d-19]; end;
if firstCall, aip2cs(19)=[+.174045700128893206465696557738d-19]; end;
if firstCall, aip2cs(20)=[-.322640979731130400247846333098d-20]; end;
if firstCall, aip2cs(21)=[+.616074471106625258533259618986d-21]; end;
if firstCall, aip2cs(22)=[-.120936347982490059076420676266d-21]; end;
if firstCall, aip2cs(23)=[+.243632763310138108261570095786d-22]; end;
if firstCall, aip2cs(24)=[-.502914221497457468943403144533d-23]; end;
if firstCall, aip2cs(25)=[+.106224175543635689495470626133d-23]; end;
if firstCall, aip2cs(26)=[-.229284284895989241509856324266d-24]; end;
if firstCall, aip2cs(27)=[+.505181733929503744986884778666d-25]; end;
if firstCall, aip2cs(28)=[-.113498123714412404979793920000d-25]; end;
if firstCall, aip2cs(29)=[+.259765565985606980698374144000d-26]; end;
if firstCall, aip2cs(30)=[-.605124621542939506172231679999d-27]; end;
if firstCall, aip2cs(31)=[+.143359777966772800720295253333d-27]; end;
if firstCall, aip2cs(32)=[-.345147757060899986280721066666d-28]; end;
if firstCall, aip2cs(33)=[+.843875190213646740427025066666d-29]; end;
if firstCall, aip2cs(34)=[-.209396142298188169434453333333d-29]; end;
if firstCall, aip2cs(35)=[+.527008873478945503182848000000d-30]; end;
if firstCall, aip2cs(36)=[-.134457433014553385789030399999d-30]; end;
if firstCall, aip2cs(37)=[+.347570964526601147340117333333d-31]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT DAIE
if( first )
eta = 0.1.*real(d1mach(3));
[naif ,aifcs,dumvar3,eta]=initds(aifcs,13,eta);
[naig ,aigcs,dumvar3,eta]=initds(aigcs,13,eta);
[naip1 ,aip1cs,dumvar3,eta]=initds(aip1cs,57,eta);
[naip2 ,aip2cs,dumvar3,eta]=initds(aip2cs,37,eta);
%
x3sml = eta.^0.3333e0;
x32sml = 1.3104d0.*x3sml.^2;
xbig = d1mach(2).^0.6666d0;
end;
first = false;
%
if( x<(-1.0d0) )
[x,xm,theta]=d9aimp(x,xm,theta);
daieresult = xm.*cos(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;
daieresult = 0.375d0 +(dcsevl(z,aifcs,naif)-x.*(0.25d0+dcsevl(z,aigcs,naig)));
if( x>x32sml )
daieresult = daieresult.*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>4.0d0 ) ;
%
sqrtx = sqrt(x);
z = -1.0d0;
if( x<xbig )
z = 16.0d0./(x.*sqrtx) - 1.0d0;
end;
daieresult =(0.28125d0+dcsevl(z,aip2cs,naip2))./sqrt(sqrtx);
else;
sqrtx = sqrt(x);
z =(16.0d0./(x.*sqrtx)-9.0d0)./7.0d0;
daieresult =(0.28125d0+dcsevl(z,aip1cs,naip1))./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 DAI