function [x,ampl,theta]=r9aimp(x,ampl,theta);
persistent am21cs am22cs ath1cs ath2cs eta first firstCall nam21 nam22 nath1 nath2 pi4 sqrtx xsml z ; if isempty(firstCall),firstCall=1;end;
if isempty(am21cs), am21cs=zeros(1,40); end;
if isempty(am22cs), am22cs=zeros(1,33); end;
if isempty(ath1cs), ath1cs=zeros(1,36); end;
if isempty(ath2cs), ath2cs=zeros(1,32); end;
if isempty(eta), eta=0; end;
if isempty(pi4), pi4=0; end;
if isempty(sqrtx), sqrtx=0; end;
if isempty(xsml), xsml=0; end;
if isempty(z), z=0; end;
if isempty(nam21), nam21=0; end;
if isempty(nam22), nam22=0; end;
if isempty(nath1), nath1=0; end;
if isempty(nath2), nath2=0; end;
%***BEGIN PROLOGUE R9AIMP
%***SUBSIDIARY
%***PURPOSE Evaluate the Airy modulus and phase.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C10D
%***TYPE SINGLE PRECISION (R9AIMP-S, D9AIMP-D)
%***KEYWORDS AIRY FUNCTION, FNLIB, MODULUS, PHASE, SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% Evaluate the Airy modulus and phase for X .LE. -1.0
%
% Series for AM21 on the interval -1.25000D-01 to 0.
% with weighted error 2.89E-17
% log weighted error 16.54
% significant figures required 14.15
% decimal places required 17.34
%
% Series for ATH1 on the interval -1.25000D-01 to 0.
% with weighted error 2.53E-17
% log weighted error 16.60
% significant figures required 15.15
% decimal places required 17.38
%
% Series for AM22 on the interval -1.00000D+00 to -1.25000D-01
% with weighted error 2.99E-17
% log weighted error 16.52
% significant figures required 14.57
% decimal places required 17.28
%
% Series for ATH2 on the interval -1.00000D+00 to -1.25000D-01
% with weighted error 2.57E-17
% log weighted error 16.59
% significant figures required 15.07
% decimal places required 17.34
%
%***REFERENCES (NONE)
%***ROUTINES CALLED CSEVL, INITS, R1MACH, XERMSG
%***REVISION HISTORY (YYMMDD)
% 770701 DATE WRITTEN
% 890206 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)
% 900720 Routine changed from user-callable to subsidiary. (WRB)
%***end PROLOGUE R9AIMP
if isempty(first), first=false; end;
if firstCall, am21cs(1)=[.0065809191761485e0]; end;
if firstCall, am21cs(2)=[.0023675984685722e0]; end;
if firstCall, am21cs(3)=[.0001324741670371e0]; end;
if firstCall, am21cs(4)=[.0000157600904043e0]; end;
if firstCall, am21cs(5)=[.0000027529702663e0]; end;
if firstCall, am21cs(6)=[.0000006102679017e0]; end;
if firstCall, am21cs(7)=[.0000001595088468e0]; end;
if firstCall, am21cs(8)=[.0000000471033947e0]; end;
if firstCall, am21cs(9)=[.0000000152933871e0]; end;
if firstCall, am21cs(10)=[.0000000053590722e0]; end;
if firstCall, am21cs(11)=[.0000000020000910e0]; end;
if firstCall, am21cs(12)=[.0000000007872292e0]; end;
if firstCall, am21cs(13)=[.0000000003243103e0]; end;
if firstCall, am21cs(14)=[.0000000001390106e0]; end;
if firstCall, am21cs(15)=[.0000000000617011e0]; end;
if firstCall, am21cs(16)=[.0000000000282491e0]; end;
if firstCall, am21cs(17)=[.0000000000132979e0]; end;
if firstCall, am21cs(18)=[.0000000000064188e0]; end;
if firstCall, am21cs(19)=[.0000000000031697e0]; end;
if firstCall, am21cs(20)=[.0000000000015981e0]; end;
if firstCall, am21cs(21)=[.0000000000008213e0]; end;
if firstCall, am21cs(22)=[.0000000000004296e0]; end;
if firstCall, am21cs(23)=[.0000000000002284e0]; end;
if firstCall, am21cs(24)=[.0000000000001232e0]; end;
if firstCall, am21cs(25)=[.0000000000000675e0]; end;
if firstCall, am21cs(26)=[.0000000000000374e0]; end;
if firstCall, am21cs(27)=[.0000000000000210e0]; end;
if firstCall, am21cs(28)=[.0000000000000119e0]; end;
if firstCall, am21cs(29)=[.0000000000000068e0]; end;
if firstCall, am21cs(30)=[.0000000000000039e0]; end;
if firstCall, am21cs(31)=[.0000000000000023e0]; end;
if firstCall, am21cs(32)=[.0000000000000013e0]; end;
if firstCall, am21cs(33)=[.0000000000000008e0]; end;
if firstCall, am21cs(34)=[.0000000000000005e0]; end;
if firstCall, am21cs(35)=[.0000000000000003e0]; end;
if firstCall, am21cs(36)=[.0000000000000001e0]; end;
if firstCall, am21cs(37)=[.0000000000000001e0]; end;
if firstCall, am21cs(38)=[.0000000000000000e0]; end;
if firstCall, am21cs(39)=[.0000000000000000e0]; end;
if firstCall, am21cs(40)=[.0000000000000000e0]; end;
if firstCall, ath1cs(1)=[-.07125837815669365e0]; end;
if firstCall, ath1cs(2)=[-.00590471979831451e0]; end;
if firstCall, ath1cs(3)=[-.00012114544069499e0]; end;
if firstCall, ath1cs(4)=[-.00000988608542270e0]; end;
if firstCall, ath1cs(5)=[-.00000138084097352e0]; end;
if firstCall, ath1cs(6)=[-.00000026142640172e0]; end;
if firstCall, ath1cs(7)=[-.00000006050432589e0]; end;
if firstCall, ath1cs(8)=[-.00000001618436223e0]; end;
if firstCall, ath1cs(9)=[-.00000000483464911e0]; end;
if firstCall, ath1cs(10)=[-.00000000157655272e0]; end;
if firstCall, ath1cs(11)=[-.00000000055231518e0]; end;
if firstCall, ath1cs(12)=[-.00000000020545441e0]; end;
if firstCall, ath1cs(13)=[-.00000000008043412e0]; end;
if firstCall, ath1cs(14)=[-.00000000003291252e0]; end;
if firstCall, ath1cs(15)=[-.00000000001399875e0]; end;
if firstCall, ath1cs(16)=[-.00000000000616151e0]; end;
if firstCall, ath1cs(17)=[-.00000000000279614e0]; end;
if firstCall, ath1cs(18)=[-.00000000000130428e0]; end;
if firstCall, ath1cs(19)=[-.00000000000062373e0]; end;
if firstCall, ath1cs(20)=[-.00000000000030512e0]; end;
if firstCall, ath1cs(21)=[-.00000000000015239e0]; end;
if firstCall, ath1cs(22)=[-.00000000000007758e0]; end;
if firstCall, ath1cs(23)=[-.00000000000004020e0]; end;
if firstCall, ath1cs(24)=[-.00000000000002117e0]; end;
if firstCall, ath1cs(25)=[-.00000000000001132e0]; end;
if firstCall, ath1cs(26)=[-.00000000000000614e0]; end;
if firstCall, ath1cs(27)=[-.00000000000000337e0]; end;
if firstCall, ath1cs(28)=[-.00000000000000188e0]; end;
if firstCall, ath1cs(29)=[-.00000000000000105e0]; end;
if firstCall, ath1cs(30)=[-.00000000000000060e0]; end;
if firstCall, ath1cs(31)=[-.00000000000000034e0]; end;
if firstCall, ath1cs(32)=[-.00000000000000020e0]; end;
if firstCall, ath1cs(33)=[-.00000000000000011e0]; end;
if firstCall, ath1cs(34)=[-.00000000000000007e0]; end;
if firstCall, ath1cs(35)=[-.00000000000000004e0]; end;
if firstCall, ath1cs(36)=[-.00000000000000002e0]; end;
if firstCall, am22cs(1)=[-.01562844480625341e0]; end;
if firstCall, am22cs(2)=[.00778336445239681e0]; end;
if firstCall, am22cs(3)=[.00086705777047718e0]; end;
if firstCall, am22cs(4)=[.00015696627315611e0]; end;
if firstCall, am22cs(5)=[.00003563962571432e0]; end;
if firstCall, am22cs(6)=[.00000924598335425e0]; end;
if firstCall, am22cs(7)=[.00000262110161850e0]; end;
if firstCall, am22cs(8)=[.00000079188221651e0]; end;
if firstCall, am22cs(9)=[.00000025104152792e0]; end;
if firstCall, am22cs(10)=[.00000008265223206e0]; end;
if firstCall, am22cs(11)=[.00000002805711662e0]; end;
if firstCall, am22cs(12)=[.00000000976821090e0]; end;
if firstCall, am22cs(13)=[.00000000347407923e0]; end;
if firstCall, am22cs(14)=[.00000000125828132e0]; end;
if firstCall, am22cs(15)=[.00000000046298826e0]; end;
if firstCall, am22cs(16)=[.00000000017272825e0]; end;
if firstCall, am22cs(17)=[.00000000006523192e0]; end;
if firstCall, am22cs(18)=[.00000000002490471e0]; end;
if firstCall, am22cs(19)=[.00000000000960156e0]; end;
if firstCall, am22cs(20)=[.00000000000373448e0]; end;
if firstCall, am22cs(21)=[.00000000000146417e0]; end;
if firstCall, am22cs(22)=[.00000000000057826e0]; end;
if firstCall, am22cs(23)=[.00000000000022991e0]; end;
if firstCall, am22cs(24)=[.00000000000009197e0]; end;
if firstCall, am22cs(25)=[.00000000000003700e0]; end;
if firstCall, am22cs(26)=[.00000000000001496e0]; end;
if firstCall, am22cs(27)=[.00000000000000608e0]; end;
if firstCall, am22cs(28)=[.00000000000000248e0]; end;
if firstCall, am22cs(29)=[.00000000000000101e0]; end;
if firstCall, am22cs(30)=[.00000000000000041e0]; end;
if firstCall, am22cs(31)=[.00000000000000017e0]; end;
if firstCall, am22cs(32)=[.00000000000000007e0]; end;
if firstCall, am22cs(33)=[.00000000000000002e0]; end;
if firstCall, ath2cs(1)=[.00440527345871877e0]; end;
if firstCall, ath2cs(2)=[-.03042919452318455e0]; end;
if firstCall, ath2cs(3)=[-.00138565328377179e0]; end;
if firstCall, ath2cs(4)=[-.00018044439089549e0]; end;
if firstCall, ath2cs(5)=[-.00003380847108327e0]; end;
if firstCall, ath2cs(6)=[-.00000767818353522e0]; end;
if firstCall, ath2cs(7)=[-.00000196783944371e0]; end;
if firstCall, ath2cs(8)=[-.00000054837271158e0]; end;
if firstCall, ath2cs(9)=[-.00000016254615505e0]; end;
if firstCall, ath2cs(10)=[-.00000005053049981e0]; end;
if firstCall, ath2cs(11)=[-.00000001631580701e0]; end;
if firstCall, ath2cs(12)=[-.00000000543420411e0]; end;
if firstCall, ath2cs(13)=[-.00000000185739855e0]; end;
if firstCall, ath2cs(14)=[-.00000000064895120e0]; end;
if firstCall, ath2cs(15)=[-.00000000023105948e0]; end;
if firstCall, ath2cs(16)=[-.00000000008363282e0]; end;
if firstCall, ath2cs(17)=[-.00000000003071196e0]; end;
if firstCall, ath2cs(18)=[-.00000000001142367e0]; end;
if firstCall, ath2cs(19)=[-.00000000000429811e0]; end;
if firstCall, ath2cs(20)=[-.00000000000163389e0]; end;
if firstCall, ath2cs(21)=[-.00000000000062693e0]; end;
if firstCall, ath2cs(22)=[-.00000000000024260e0]; end;
if firstCall, ath2cs(23)=[-.00000000000009461e0]; end;
if firstCall, ath2cs(24)=[-.00000000000003716e0]; end;
if firstCall, ath2cs(25)=[-.00000000000001469e0]; end;
if firstCall, ath2cs(26)=[-.00000000000000584e0]; end;
if firstCall, ath2cs(27)=[-.00000000000000233e0]; end;
if firstCall, ath2cs(28)=[-.00000000000000093e0]; end;
if firstCall, ath2cs(29)=[-.00000000000000037e0]; end;
if firstCall, ath2cs(30)=[-.00000000000000015e0]; end;
if firstCall, ath2cs(31)=[-.00000000000000006e0]; end;
if firstCall, ath2cs(32)=[-.00000000000000002e0]; end;
if firstCall, pi4=[0.78539816339744831e0]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT R9AIMP
if( first )
eta = 0.1.*r1mach(3);
[nam21 ,am21cs,dumvar3,eta]=inits(am21cs,40,eta);
[nath1 ,ath1cs,dumvar3,eta]=inits(ath1cs,36,eta);
[nam22 ,am22cs,dumvar3,eta]=inits(am22cs,33,eta);
[nath2 ,ath2cs,dumvar3,eta]=inits(ath2cs,32,eta);
%
xsml = -1.0./r1mach(3).^0.3333;
end;
first = false;
%
if( x>=(-2.0) )
%
if( x>(-1.0) )
xermsg('SLATEC','R9AIMP','X MUST BE LE -1.0',1,2);
end;
%
z =(16.0./x.^3+9.0)./7.0;
ampl = 0.3125 + csevl(z,am22cs,nam22);
theta = -0.625 + csevl(z,ath2cs,nath2);
else;
z = 1.0;
if( x>xsml )
z = 16.0./x.^3 + 1.0;
end;
ampl = 0.3125 + csevl(z,am21cs,nam21);
theta = -0.625 + csevl(z,ath1cs,nath1);
end;
%
sqrtx = sqrt(-x);
ampl = sqrt(ampl./sqrtx);
theta = pi4 - x.*sqrtx.*theta;
%
end
%DECK R9ATN1