Code covered by the BSD License  

Highlights from
slatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[aieresult,x]=aie(x);
function [aieresult,x]=aie(x);
aieresult=[];
persistent aie aifcs aigcs aipcs eta first firstCall naif naig naip sqrtx theta x32sml x3sml xbig xm z ; if isempty(firstCall),firstCall=1;end; 

if isempty(aieresult), aieresult=0; end;
if isempty(aifcs), aifcs=zeros(1,9); end;
if isempty(aigcs), aigcs=zeros(1,8); end;
if isempty(aipcs), aipcs=zeros(1,34); 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(naif), naif=0; end;
if isempty(naig), naig=0; end;
if isempty(naip), naip=0; end;
%***BEGIN PROLOGUE  AIE
%***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      SINGLE PRECISION (AIE-S, DAIE-D)
%***KEYWORDS  EXPONENTIALLY SCALED AIRY FUNCTION, FNLIB,
%             SPECIAL FUNCTIONS
%***AUTHOR  Fullerton, W., (LANL)
%***DESCRIPTION
%
% AIE(X) computes the exponentially scaled Airy function for
% non-negative X.  It evaluates AI(X) for X .LE. 0.0 and
% EXP(ZETA)*AI(X) for X .GE. 0.0 where ZETA = (2.0/3.0)*(X**1.5).
%
% Series for AIF        on the interval -1.00000D+00 to  1.00000D+00
%                                        with weighted error   1.09E-19
%                                         log weighted error  18.96
%                               significant figures required  17.76
%                                    decimal places required  19.44
%
% Series for AIG        on the interval -1.00000D+00 to  1.00000D+00
%                                        with weighted error   1.51E-17
%                                         log weighted error  16.82
%                               significant figures required  15.19
%                                    decimal places required  17.27
%
% Series for AIP        on the interval  0.          to  1.00000D+00
%                                        with weighted error   5.10E-17
%                                         log weighted error  16.29
%                               significant figures required  14.41
%                                    decimal places required  17.06
%
%***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)
%   920618  Removed space from variable names.  (RWC, WRB)
%***end PROLOGUE  AIE
if isempty(first), first=false; end;
if firstCall,   aifcs(1)=[-.03797135849666999750e0];  end;
if firstCall,   aifcs(2)=[.05919188853726363857e0];  end;
if firstCall,   aifcs(3)=[.00098629280577279975e0];  end;
if firstCall,   aifcs(4)=[.00000684884381907656e0];  end;
if firstCall,   aifcs(5)=[.00000002594202596219e0];  end;
if firstCall,   aifcs(6)=[.00000000006176612774e0];  end;
if firstCall,   aifcs(7)=[.00000000000010092454e0];  end;
if firstCall,   aifcs(8)=[.00000000000000012014e0];  end;
if firstCall,   aifcs(9)=[.00000000000000000010e0];  end;
if firstCall,   aigcs(1)=[.01815236558116127e0];  end;
if firstCall,   aigcs(2)=[.02157256316601076e0];  end;
if firstCall,   aigcs(3)=[.00025678356987483e0];  end;
if firstCall,   aigcs(4)=[.00000142652141197e0];  end;
if firstCall,   aigcs(5)=[.00000000457211492e0];  end;
if firstCall,   aigcs(6)=[.00000000000952517e0];  end;
if firstCall,   aigcs(7)=[.00000000000001392e0];  end;
if firstCall,   aigcs(8)=[.00000000000000001e0];  end;
if firstCall,   aipcs(1)=[-.0187519297793868e0];  end;
if firstCall,   aipcs(2)=[-.0091443848250055e0];  end;
if firstCall,   aipcs(3)=[.0009010457337825e0];  end;
if firstCall,   aipcs(4)=[-.0001394184127221e0];  end;
if firstCall,   aipcs(5)=[.0000273815815785e0];  end;
if firstCall,   aipcs(6)=[-.0000062750421119e0];  end;
if firstCall,   aipcs(7)=[.0000016064844184e0];  end;
if firstCall,   aipcs(8)=[-.0000004476392158e0];  end;
if firstCall,   aipcs(9)=[.0000001334635874e0];  end;
if firstCall,   aipcs(10)=[-.0000000420735334e0];  end;
if firstCall,   aipcs(11)=[.0000000139021990e0];  end;
if firstCall,   aipcs(12)=[-.0000000047831848e0];  end;
if firstCall,   aipcs(13)=[.0000000017047897e0];  end;
if firstCall,   aipcs(14)=[-.0000000006268389e0];  end;
if firstCall,   aipcs(15)=[.0000000002369824e0];  end;
if firstCall,   aipcs(16)=[-.0000000000918641e0];  end;
if firstCall,   aipcs(17)=[.0000000000364278e0];  end;
if firstCall,   aipcs(18)=[-.0000000000147475e0];  end;
if firstCall,   aipcs(19)=[.0000000000060851e0];  end;
if firstCall,   aipcs(20)=[-.0000000000025552e0];  end;
if firstCall,   aipcs(21)=[.0000000000010906e0];  end;
if firstCall,   aipcs(22)=[-.0000000000004725e0];  end;
if firstCall,   aipcs(23)=[.0000000000002076e0];  end;
if firstCall,   aipcs(24)=[-.0000000000000924e0];  end;
if firstCall,   aipcs(25)=[.0000000000000417e0];  end;
if firstCall,   aipcs(26)=[-.0000000000000190e0];  end;
if firstCall,   aipcs(27)=[.0000000000000087e0];  end;
if firstCall,   aipcs(28)=[-.0000000000000040e0];  end;
if firstCall,   aipcs(29)=[.0000000000000019e0];  end;
if firstCall,   aipcs(30)=[-.0000000000000009e0];  end;
if firstCall,   aipcs(31)=[.0000000000000004e0];  end;
if firstCall,   aipcs(32)=[-.0000000000000002e0];  end;
if firstCall,   aipcs(33)=[.0000000000000001e0];  end;
if firstCall,   aipcs(34)=[-.0000000000000000e0];  end;
if firstCall,   first=[true];  end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT  AIE
if( first )
eta = 0.1.*r1mach(3);
[naif ,aifcs,dumvar3,eta]=inits(aifcs,9,eta);
[naig ,aigcs,dumvar3,eta]=inits(aigcs,8,eta);
[naip ,aipcs,dumvar3,eta]=inits(aipcs,34,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);
aieresult = 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.0 ) ;
%
sqrtx = sqrt(x);
z = -1.0;
if( x<xbig )
z = 2.0./(x.*sqrtx) - 1.0;
end;
aieresult =(.28125+csevl(z,aipcs,naip))./sqrt(sqrtx);
else;
z = 0.0;
if( abs(x)>x3sml )
z = x.^3;
end;
aieresult = 0.375 +(csevl(z,aifcs,naif)-x.*(0.25+csevl(z,aigcs,naig)));
if( x>x32sml )
aieresult = aieresult.*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;
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 AI

Contact us at files@mathworks.com