function [dawsresult,x]=daws(x);
dawsresult=[];
persistent daw2cs dawacs dawcs daws eps first firstCall ntdaw ntdaw2 ntdawa xbig xmax xsml y ; if isempty(firstCall),firstCall=1;end;
if isempty(daw2cs), daw2cs=zeros(1,29); end;
if isempty(dawacs), dawacs=zeros(1,26); end;
if isempty(dawcs), dawcs=zeros(1,13); end;
if isempty(dawsresult), dawsresult=0; end;
if isempty(eps), eps=0; end;
if isempty(xbig), xbig=0; end;
if isempty(xmax), xmax=0; end;
if isempty(xsml), xsml=0; end;
if isempty(y), y=0; end;
if isempty(ntdaw), ntdaw=0; end;
if isempty(ntdaw2), ntdaw2=0; end;
if isempty(ntdawa), ntdawa=0; end;
%***BEGIN PROLOGUE DAWS
%***PURPOSE Compute Dawson's function.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C8C
%***TYPE SINGLE PRECISION (DAWS-S, DDAWS-D)
%***KEYWORDS DAWSON'S FUNCTION, FNLIB, SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% DAWS(X) calculates Dawson's integral for real argument X.
%
% Series for DAW on the interval 0. to 1.00000D+00
% with weighted error 3.83E-17
% log weighted error 16.42
% significant figures required 15.78
% decimal places required 16.97
%
% Series for DAW2 on the interval 0. to 1.60000D+01
% with weighted error 5.17E-17
% log weighted error 16.29
% significant figures required 15.90
% decimal places required 17.02
%
% Series for DAWA on the interval 0. to 6.25000D-02
% with weighted error 2.24E-17
% log weighted error 16.65
% significant figures required 14.73
% decimal places required 17.36
%
%***REFERENCES (NONE)
%***ROUTINES CALLED CSEVL, INITS, R1MACH, XERMSG
%***REVISION HISTORY (YYMMDD)
% 780401 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)
% 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
% 920618 Removed space from variable names. (RWC, WRB)
%***end PROLOGUE DAWS
if isempty(first), first=false; end;
if firstCall, dawcs(1)=[-.006351734375145949e0]; end;
if firstCall, dawcs(2)=[-.22940714796773869e0]; end;
if firstCall, dawcs(3)=[.022130500939084764e0]; end;
if firstCall, dawcs(4)=[-.001549265453892985e0]; end;
if firstCall, dawcs(5)=[.000084973277156849e0]; end;
if firstCall, dawcs(6)=[-.000003828266270972e0]; end;
if firstCall, dawcs(7)=[.000000146285480625e0]; end;
if firstCall, dawcs(8)=[-.000000004851982381e0]; end;
if firstCall, dawcs(9)=[.000000000142146357e0]; end;
if firstCall, dawcs(10)=[-.000000000003728836e0]; end;
if firstCall, dawcs(11)=[.000000000000088549e0]; end;
if firstCall, dawcs(12)=[-.000000000000001920e0]; end;
if firstCall, dawcs(13)=[.000000000000000038e0]; end;
if firstCall, daw2cs(1)=[-.056886544105215527e0]; end;
if firstCall, daw2cs(2)=[-.31811346996168131e0]; end;
if firstCall, daw2cs(3)=[.20873845413642237e0]; end;
if firstCall, daw2cs(4)=[-.12475409913779131e0]; end;
if firstCall, daw2cs(5)=[.067869305186676777e0]; end;
if firstCall, daw2cs(6)=[-.033659144895270940e0]; end;
if firstCall, daw2cs(7)=[.015260781271987972e0]; end;
if firstCall, daw2cs(8)=[-.006348370962596214e0]; end;
if firstCall, daw2cs(9)=[.002432674092074852e0]; end;
if firstCall, daw2cs(10)=[-.000862195414910650e0]; end;
if firstCall, daw2cs(11)=[.000283765733363216e0]; end;
if firstCall, daw2cs(12)=[-.000087057549874170e0]; end;
if firstCall, daw2cs(13)=[.000024986849985481e0]; end;
if firstCall, daw2cs(14)=[-.000006731928676416e0]; end;
if firstCall, daw2cs(15)=[.000001707857878557e0]; end;
if firstCall, daw2cs(16)=[-.000000409175512264e0]; end;
if firstCall, daw2cs(17)=[.000000092828292216e0]; end;
if firstCall, daw2cs(18)=[-.000000019991403610e0]; end;
if firstCall, daw2cs(19)=[.000000004096349064e0]; end;
if firstCall, daw2cs(20)=[-.000000000800324095e0]; end;
if firstCall, daw2cs(21)=[.000000000149385031e0]; end;
if firstCall, daw2cs(22)=[-.000000000026687999e0]; end;
if firstCall, daw2cs(23)=[.000000000004571221e0]; end;
if firstCall, daw2cs(24)=[-.000000000000751873e0]; end;
if firstCall, daw2cs(25)=[.000000000000118931e0]; end;
if firstCall, daw2cs(26)=[-.000000000000018116e0]; end;
if firstCall, daw2cs(27)=[.000000000000002661e0]; end;
if firstCall, daw2cs(28)=[-.000000000000000377e0]; end;
if firstCall, daw2cs(29)=[.000000000000000051e0]; end;
if firstCall, dawacs(1)=[.01690485637765704e0]; end;
if firstCall, dawacs(2)=[.00868325227840695e0]; end;
if firstCall, dawacs(3)=[.00024248640424177e0]; end;
if firstCall, dawacs(4)=[.00001261182399572e0]; end;
if firstCall, dawacs(5)=[.00000106645331463e0]; end;
if firstCall, dawacs(6)=[.00000013581597947e0]; end;
if firstCall, dawacs(7)=[.00000002171042356e0]; end;
if firstCall, dawacs(8)=[.00000000286701050e0]; end;
if firstCall, dawacs(9)=[-.00000000019013363e0]; end;
if firstCall, dawacs(10)=[-.00000000030977804e0]; end;
if firstCall, dawacs(11)=[-.00000000010294148e0]; end;
if firstCall, dawacs(12)=[-.00000000000626035e0]; end;
if firstCall, dawacs(13)=[.00000000000856313e0]; end;
if firstCall, dawacs(14)=[.00000000000303304e0]; end;
if firstCall, dawacs(15)=[-.00000000000025236e0]; end;
if firstCall, dawacs(16)=[-.00000000000042106e0]; end;
if firstCall, dawacs(17)=[-.00000000000004431e0]; end;
if firstCall, dawacs(18)=[.00000000000004911e0]; end;
if firstCall, dawacs(19)=[.00000000000001235e0]; end;
if firstCall, dawacs(20)=[-.00000000000000578e0]; end;
if firstCall, dawacs(21)=[-.00000000000000228e0]; end;
if firstCall, dawacs(22)=[.00000000000000076e0]; end;
if firstCall, dawacs(23)=[.00000000000000038e0]; end;
if firstCall, dawacs(24)=[-.00000000000000011e0]; end;
if firstCall, dawacs(25)=[-.00000000000000006e0]; end;
if firstCall, dawacs(26)=[.00000000000000002e0]; end;
if firstCall, first=[true]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT DAWS
if( first )
[eps ]=r1mach(3);
[ntdaw ,dawcs]=inits(dawcs,13,0.1.*eps);
[ntdaw2 ,daw2cs]=inits(daw2cs,29,0.1.*eps);
[ntdawa ,dawacs]=inits(dawacs,26,0.1.*eps);
%
xsml = sqrt(1.5.*eps);
xbig = sqrt(0.5./eps);
xmax = exp(min(-log(2..*r1mach(1)),log(r1mach(2)))-1.0);
end;
first = false;
%
y = abs(x);
if( y<=1.0 )
%
dawsresult = x;
if( y<=xsml )
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;
%
dawsresult = x.*(0.75+csevl(2.0.*y.*y-1.0,dawcs,ntdaw));
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( y<=4.0 ) ;
dawsresult = x.*(0.25+csevl(0.125.*y.*y-1.0,daw2cs,ntdaw2));
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( y>xmax ) ;
%
xermsg('SLATEC','DAWS','ABS(X) SO LARGE DAWS UNDERFLOWS',1,1);
dawsresult = 0.0;
else;
dawsresult = 0.5./x;
if( y>xbig )
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;
%
dawsresult =(0.5+csevl(32.0./y.^2-1.0,dawacs,ntdawa))./x;
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 DAXPY