function [bieresult,x]=bie(x);
bieresult=[];
persistent atr bie bif2cs bifcs big2cs bigcs bip2cs bipcs btr eta first firstCall nbif nbif2 nbig nbig2 nbip nbip2 sqrtx theta x32sml x3sml xbig xm z ; if isempty(firstCall),firstCall=1;end;
if isempty(atr), atr=0; end;
if isempty(bieresult), bieresult=0; end;
if isempty(bif2cs), bif2cs=zeros(1,10); end;
if isempty(bifcs), bifcs=zeros(1,9); end;
if isempty(big2cs), big2cs=zeros(1,10); end;
if isempty(bigcs), bigcs=zeros(1,8); end;
if isempty(bip2cs), bip2cs=zeros(1,29); end;
if isempty(bipcs), bipcs=zeros(1,24); end;
if isempty(btr), btr=0; end;
if isempty(eta), eta=0; end;
if isempty(sqrtx), sqrtx=0; end;
if isempty(theta), theta=0; end;
if isempty(x32sml), x32sml=0; end;
if isempty(x3sml), x3sml=0; end;
if isempty(xbig), xbig=0; end;
if isempty(xm), xm=0; end;
if isempty(z), z=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(nbip), nbip=0; end;
if isempty(nbip2), nbip2=0; end;
%***BEGIN PROLOGUE BIE
%***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 SINGLE PRECISION (BIE-S, DBIE-D)
%***KEYWORDS BAIRY FUNCTION, EXPONENTIALLY SCALED, FNLIB,
% SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% Evaluate BI(X) for X .LE. 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.00000D+00 to 1.00000D+00
% with weighted error 1.88E-19
% log weighted error 18.72
% significant figures required 17.74
% decimal places required 19.20
%
% Series for BIG on the interval -1.00000D+00 to 1.00000D+00
% with weighted error 2.61E-17
% log weighted error 16.58
% significant figures required 15.17
% decimal places required 17.03
%
% Series for BIF2 on the interval 1.00000D+00 to 8.00000D+00
% with weighted error 1.11E-17
% log weighted error 16.95
% approx significant figures required 16.5
% decimal places required 17.45
%
% Series for BIG2 on the interval 1.00000D+00 to 8.00000D+00
% with weighted error 1.19E-18
% log weighted error 17.92
% approx significant figures required 17.2
% decimal places required 18.42
%
% Series for BIP on the interval 1.25000D-01 to 3.53553D-01
% with weighted error 1.91E-17
% log weighted error 16.72
% significant figures required 15.35
% decimal places required 17.41
%
% Series for BIP2 on the interval 0. to 1.25000D-01
% with weighted error 1.05E-18
% log weighted error 17.98
% significant figures required 16.74
% decimal places required 18.71
%
%***REFERENCES (NONE)
%***ROUTINES CALLED CSEVL, INITS, R1MACH, R9AIMP
%***REVISION HISTORY (YYMMDD)
% 770701 DATE WRITTEN
% 890206 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
%***end PROLOGUE BIE
if isempty(first), first=false; end;
if firstCall, bifcs(1)=[-.01673021647198664948e0]; end;
if firstCall, bifcs(2)=[.1025233583424944561e0]; end;
if firstCall, bifcs(3)=[.00170830925073815165e0]; end;
if firstCall, bifcs(4)=[.00001186254546774468e0]; end;
if firstCall, bifcs(5)=[.00000004493290701779e0]; end;
if firstCall, bifcs(6)=[.00000000010698207143e0]; end;
if firstCall, bifcs(7)=[.00000000000017480643e0]; end;
if firstCall, bifcs(8)=[.00000000000000020810e0]; end;
if firstCall, bifcs(9)=[.00000000000000000018e0]; end;
if firstCall, bigcs(1)=[.02246622324857452e0]; end;
if firstCall, bigcs(2)=[.03736477545301955e0]; end;
if firstCall, bigcs(3)=[.00044476218957212e0]; end;
if firstCall, bigcs(4)=[.00000247080756363e0]; end;
if firstCall, bigcs(5)=[.00000000791913533e0]; end;
if firstCall, bigcs(6)=[.00000000001649807e0]; end;
if firstCall, bigcs(7)=[.00000000000002411e0]; end;
if firstCall, bigcs(8)=[.00000000000000002e0]; end;
if firstCall, bif2cs(1)=[0.09984572693816041e0]; end;
if firstCall, bif2cs(2)=[.478624977863005538e0]; end;
if firstCall, bif2cs(3)=[.0251552119604330118e0]; end;
if firstCall, bif2cs(4)=[.0005820693885232645e0]; end;
if firstCall, bif2cs(5)=[.0000074997659644377e0]; end;
if firstCall, bif2cs(6)=[.0000000613460287034e0]; end;
if firstCall, bif2cs(7)=[.0000000003462753885e0]; end;
if firstCall, bif2cs(8)=[.0000000000014288910e0]; end;
if firstCall, bif2cs(9)=[.0000000000000044962e0]; end;
if firstCall, bif2cs(10)=[.0000000000000000111e0]; end;
if firstCall, big2cs(1)=[.033305662145514340e0]; end;
if firstCall, big2cs(2)=[.161309215123197068e0]; end;
if firstCall, big2cs(3)=[.0063190073096134286e0]; end;
if firstCall, big2cs(4)=[.0001187904568162517e0]; end;
if firstCall, big2cs(5)=[.0000013045345886200e0]; end;
if firstCall, big2cs(6)=[.0000000093741259955e0]; end;
if firstCall, big2cs(7)=[.0000000000474580188e0]; end;
if firstCall, big2cs(8)=[.0000000000001783107e0]; end;
if firstCall, big2cs(9)=[.0000000000000005167e0]; end;
if firstCall, big2cs(10)=[.0000000000000000011e0]; end;
if firstCall, bipcs(1)=[-.08322047477943447e0]; end;
if firstCall, bipcs(2)=[.01146118927371174e0]; end;
if firstCall, bipcs(3)=[.00042896440718911e0]; end;
if firstCall, bipcs(4)=[-.00014906639379950e0]; end;
if firstCall, bipcs(5)=[-.00001307659726787e0]; end;
if firstCall, bipcs(6)=[.00000632759839610e0]; end;
if firstCall, bipcs(7)=[-.00000042226696982e0]; end;
if firstCall, bipcs(8)=[-.00000019147186298e0]; end;
if firstCall, bipcs(9)=[.00000006453106284e0]; end;
if firstCall, bipcs(10)=[-.00000000784485467e0]; end;
if firstCall, bipcs(11)=[-.00000000096077216e0]; end;
if firstCall, bipcs(12)=[.00000000070004713e0]; end;
if firstCall, bipcs(13)=[-.00000000017731789e0]; end;
if firstCall, bipcs(14)=[.00000000002272089e0]; end;
if firstCall, bipcs(15)=[.00000000000165404e0]; end;
if firstCall, bipcs(16)=[-.00000000000185171e0]; end;
if firstCall, bipcs(17)=[.00000000000059576e0]; end;
if firstCall, bipcs(18)=[-.00000000000012194e0]; end;
if firstCall, bipcs(19)=[.00000000000001334e0]; end;
if firstCall, bipcs(20)=[.00000000000000172e0]; end;
if firstCall, bipcs(21)=[-.00000000000000145e0]; end;
if firstCall, bipcs(22)=[.00000000000000049e0]; end;
if firstCall, bipcs(23)=[-.00000000000000011e0]; end;
if firstCall, bipcs(24)=[.00000000000000001e0]; end;
if firstCall, bip2cs(1)=[-.113596737585988679e0]; end;
if firstCall, bip2cs(2)=[.0041381473947881595e0]; end;
if firstCall, bip2cs(3)=[.0001353470622119332e0]; end;
if firstCall, bip2cs(4)=[.0000104273166530153e0]; end;
if firstCall, bip2cs(5)=[.0000013474954767849e0]; end;
if firstCall, bip2cs(6)=[.0000001696537405438e0]; end;
if firstCall, bip2cs(7)=[-.0000000100965008656e0]; end;
if firstCall, bip2cs(8)=[-.0000000167291194937e0]; end;
if firstCall, bip2cs(9)=[-.0000000045815364485e0]; end;
if firstCall, bip2cs(10)=[.0000000003736681366e0]; end;
if firstCall, bip2cs(11)=[.0000000005766930320e0]; end;
if firstCall, bip2cs(12)=[.0000000000621812650e0]; end;
if firstCall, bip2cs(13)=[-.0000000000632941202e0]; end;
if firstCall, bip2cs(14)=[-.0000000000149150479e0]; end;
if firstCall, bip2cs(15)=[.0000000000078896213e0]; end;
if firstCall, bip2cs(16)=[.0000000000024960513e0]; end;
if firstCall, bip2cs(17)=[-.0000000000012130075e0]; end;
if firstCall, bip2cs(18)=[-.0000000000003740493e0]; end;
if firstCall, bip2cs(19)=[.0000000000002237727e0]; end;
if firstCall, bip2cs(20)=[.0000000000000474902e0]; end;
if firstCall, bip2cs(21)=[-.0000000000000452616e0]; end;
if firstCall, bip2cs(22)=[-.0000000000000030172e0]; end;
if firstCall, bip2cs(23)=[.0000000000000091058e0]; end;
if firstCall, bip2cs(24)=[-.0000000000000009814e0]; end;
if firstCall, bip2cs(25)=[-.0000000000000016429e0]; end;
if firstCall, bip2cs(26)=[.0000000000000005533e0]; end;
if firstCall, bip2cs(27)=[.0000000000000002175e0]; end;
if firstCall, bip2cs(28)=[-.0000000000000001737e0]; end;
if firstCall, bip2cs(29)=[-.0000000000000000010e0]; end;
if firstCall, atr=[8.7506905708484345e0]; end;
if firstCall, btr=[-2.093836321356054e0]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT BIE
if( first )
eta = 0.1.*r1mach(3);
[nbif ,bifcs,dumvar3,eta]=inits(bifcs,9,eta);
[nbig ,bigcs,dumvar3,eta]=inits(bigcs,8,eta);
[nbif2 ,bif2cs,dumvar3,eta]=inits(bif2cs,10,eta);
[nbig2 ,big2cs,dumvar3,eta]=inits(big2cs,10,eta);
[nbip ,bipcs,dumvar3,eta]=inits(bipcs,24,eta);
[nbip2 ,bip2cs,dumvar3,eta]=inits(bip2cs,29,eta);
%
x3sml = eta.^0.3333;
x32sml = 1.3104.*x3sml.^2;
xbig = r1mach(2).^0.6666;
end;
first = false;
%
if( x<(-1.0) )
[x,xm,theta]=r9aimp(x,xm,theta);
bieresult = 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.0 ) ;
z = 0.0;
if( abs(x)>x3sml )
z = x.^3;
end;
bieresult = 0.625 + csevl(z,bifcs,nbif)+ x.*(0.4375+csevl(z,bigcs,nbig));
if( x>x32sml )
bieresult = bieresult.*exp(-2.0.*x.*sqrt(x)./3.0);
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.0 ) ;
z =(2.0.*x.^3-9.0)./7.0;
bieresult = exp(-2.0.*x.*sqrt(x)./3.0).*(1.125+csevl(z,bif2cs,nbif2)+x.*(0.625+csevl(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.0 ) ;
%
sqrtx = sqrt(x);
z = -1.0;
if( x<xbig )
z = 16.0./(x.*sqrtx) - 1.0;
end;
bieresult =(0.625+csevl(z,bip2cs,nbip2))./sqrt(sqrtx);
else;
sqrtx = sqrt(x);
z = atr./(x.*sqrtx) + btr;
bieresult =(0.625+csevl(z,bipcs,nbip))./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 BI