Code covered by the BSD License  

Highlights from
slatec

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

[besi1eresult,x]=besi1e(x);
function [besi1eresult,x]=besi1e(x);
besi1eresult=[];
persistent ai12cs ai1cs besi1e bi1cs first firstCall ntai1 ntai12 nti1 xmin xsml y ; if isempty(firstCall),firstCall=1;end; 

if isempty(ai12cs), ai12cs=zeros(1,22); end;
if isempty(ai1cs), ai1cs=zeros(1,21); end;
if isempty(besi1eresult), besi1eresult=0; end;
if isempty(bi1cs), bi1cs=zeros(1,11); end;
if isempty(xmin), xmin=0; end;
if isempty(xsml), xsml=0; end;
if isempty(y), y=0; end;
if isempty(ntai1), ntai1=0; end;
if isempty(ntai12), ntai12=0; end;
if isempty(nti1), nti1=0; end;
%***BEGIN PROLOGUE  BESI1E
%***PURPOSE  Compute the exponentially scaled modified (hyperbolic)
%            Bessel function of the first kind of order one.
%***LIBRARY   SLATEC (FNLIB)
%***CATEGORY  C10B1
%***TYPE      SINGLE PRECISION (BESI1E-S, DBSI1E-D)
%***KEYWORDS  EXPONENTIALLY SCALED, FIRST KIND, FNLIB,
%             HYPERBOLIC BESSEL FUNCTION, MODIFIED BESSEL FUNCTION,
%             ORDER ONE, SPECIAL FUNCTIONS
%***AUTHOR  Fullerton, W., (LANL)
%***DESCRIPTION
%
% BESI1E(X) calculates the exponentially scaled modified (hyperbolic)
% Bessel function of the first kind of order one for real argument X;
% i.e., EXP(-ABS(X))*I1(X).
%
% Series for BI1        on the interval  0.          to  9.00000D+00
%                                        with weighted error   2.40E-17
%                                         log weighted error  16.62
%                               significant figures required  16.23
%                                    decimal places required  17.14
%
% Series for AI1        on the interval  1.25000D-01 to  3.33333D-01
%                                        with weighted error   6.98E-17
%                                         log weighted error  16.16
%                               significant figures required  14.53
%                                    decimal places required  16.82
%
% Series for AI12       on the interval  0.          to  1.25000D-01
%                                        with weighted error   3.55E-17
%                                         log weighted error  16.45
%                               significant figures required  14.69
%                                    decimal places required  17.12
%
%***REFERENCES  (NONE)
%***ROUTINES CALLED  CSEVL, INITS, R1MACH, XERMSG
%***REVISION HISTORY  (YYMMDD)
%   770401  DATE WRITTEN
%   890210  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)
%   900326  Removed duplicate information from DESCRIPTION section.
%           (WRB)
%   920618  Removed space from variable names.  (RWC, WRB)
%***end PROLOGUE  BESI1E
if isempty(first), first=false; end;
if firstCall,   bi1cs(1)=[-.001971713261099859e0];  end;
if firstCall,   bi1cs(2)=[.40734887667546481e0];  end;
if firstCall,   bi1cs(3)=[.034838994299959456e0];  end;
if firstCall,   bi1cs(4)=[.001545394556300123e0];  end;
if firstCall,   bi1cs(5)=[.000041888521098377e0];  end;
if firstCall,   bi1cs(6)=[.000000764902676483e0];  end;
if firstCall,   bi1cs(7)=[.000000010042493924e0];  end;
if firstCall,   bi1cs(8)=[.000000000099322077e0];  end;
if firstCall,   bi1cs(9)=[.000000000000766380e0];  end;
if firstCall,   bi1cs(10)=[.000000000000004741e0];  end;
if firstCall,   bi1cs(11)=[.000000000000000024e0];  end;
if firstCall,   ai1cs(1)=[-.02846744181881479e0];  end;
if firstCall,   ai1cs(2)=[-.01922953231443221e0];  end;
if firstCall,   ai1cs(3)=[-.00061151858579437e0];  end;
if firstCall,   ai1cs(4)=[-.00002069971253350e0];  end;
if firstCall,   ai1cs(5)=[.00000858561914581e0];  end;
if firstCall,   ai1cs(6)=[.00000104949824671e0];  end;
if firstCall,   ai1cs(7)=[-.00000029183389184e0];  end;
if firstCall,   ai1cs(8)=[-.00000001559378146e0];  end;
if firstCall,   ai1cs(9)=[.00000001318012367e0];  end;
if firstCall,   ai1cs(10)=[-.00000000144842341e0];  end;
if firstCall,   ai1cs(11)=[-.00000000029085122e0];  end;
if firstCall,   ai1cs(12)=[.00000000012663889e0];  end;
if firstCall,   ai1cs(13)=[-.00000000001664947e0];  end;
if firstCall,   ai1cs(14)=[-.00000000000166665e0];  end;
if firstCall,   ai1cs(15)=[.00000000000124260e0];  end;
if firstCall,   ai1cs(16)=[-.00000000000027315e0];  end;
if firstCall,   ai1cs(17)=[.00000000000002023e0];  end;
if firstCall,   ai1cs(18)=[.00000000000000730e0];  end;
if firstCall,   ai1cs(19)=[-.00000000000000333e0];  end;
if firstCall,   ai1cs(20)=[.00000000000000071e0];  end;
if firstCall,   ai1cs(21)=[-.00000000000000006e0];  end;
if firstCall,   ai12cs(1)=[.02857623501828014e0];  end;
if firstCall,   ai12cs(2)=[-.00976109749136147e0];  end;
if firstCall,   ai12cs(3)=[-.00011058893876263e0];  end;
if firstCall,   ai12cs(4)=[-.00000388256480887e0];  end;
if firstCall,   ai12cs(5)=[-.00000025122362377e0];  end;
if firstCall,   ai12cs(6)=[-.00000002631468847e0];  end;
if firstCall,   ai12cs(7)=[-.00000000383538039e0];  end;
if firstCall,   ai12cs(8)=[-.00000000055897433e0];  end;
if firstCall,   ai12cs(9)=[-.00000000001897495e0];  end;
if firstCall,   ai12cs(10)=[.00000000003252602e0];  end;
if firstCall,   ai12cs(11)=[.00000000001412580e0];  end;
if firstCall,   ai12cs(12)=[.00000000000203564e0];  end;
if firstCall,   ai12cs(13)=[-.00000000000071985e0];  end;
if firstCall,   ai12cs(14)=[-.00000000000040836e0];  end;
if firstCall,   ai12cs(15)=[-.00000000000002101e0];  end;
if firstCall,   ai12cs(16)=[.00000000000004273e0];  end;
if firstCall,   ai12cs(17)=[.00000000000001041e0];  end;
if firstCall,   ai12cs(18)=[-.00000000000000382e0];  end;
if firstCall,   ai12cs(19)=[-.00000000000000186e0];  end;
if firstCall,   ai12cs(20)=[.00000000000000033e0];  end;
if firstCall,   ai12cs(21)=[.00000000000000028e0];  end;
if firstCall,   ai12cs(22)=[-.00000000000000003e0];  end;
if firstCall,   first=[true];  end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT  BESI1E
if( first )
[nti1 ,bi1cs]=inits(bi1cs,11,0.1.*r1mach(3));
[ntai1 ,ai1cs]=inits(ai1cs,21,0.1.*r1mach(3));
[ntai12 ,ai12cs]=inits(ai12cs,22,0.1.*r1mach(3));
%
xmin = 2.0.*r1mach(1);
xsml = sqrt(4.5.*r1mach(3));
end;
first = false;
%
y = abs(x);
if( y>3.0 )
%
if( y<=8. )
besi1eresult =(.375+csevl((48../y-11.)./5.,ai1cs,ntai1))./sqrt(y);
end;
if( y>8. )
besi1eresult =(.375+csevl(16../y-1.0,ai12cs,ntai12))./sqrt(y);
end;
besi1eresult = (abs(besi1eresult).*sign(x));
else;
%
besi1eresult = 0.0;
if( y==0.0 )
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;
%
if( y<=xmin )
xermsg('SLATEC','BESI1E','ABS(X) SO SMALL I1 UNDERFLOWS',1,1);
end;
if( y>xmin )
besi1eresult = 0.5.*x;
end;
if( y>xsml )
besi1eresult = x.*(.875+csevl(y.*y./4.5-1.,bi1cs,nti1));
end;
besi1eresult = exp(-y).*besi1eresult;
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 BESI1

Contact us at files@mathworks.com