Code covered by the BSD License  

Highlights from
slatec

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

[lun,kprint,ipass]=cfnck(lun,kprint,ipass);
function [lun,kprint,ipass]=cfnck(lun,kprint,ipass);
persistent abserr c c1 ci errmax errtol firstCall i pi relerr sqrt2 sqrt3 w ; if isempty(firstCall),firstCall=1;end; 

if isempty(i), i=0; end;
if isempty(sqrt2), sqrt2=0; end;
if isempty(sqrt3), sqrt3=0; end;
if isempty(pi), pi=0; end;
if isempty(errmax), errmax=0; end;
if isempty(errtol), errtol=0; end;
if isempty(abserr), abserr=0; end;
if isempty(relerr), relerr=0; end;
if isempty(c), c=zeros(1,48); end;
if isempty(w), w=zeros(1,48); end;
if isempty(c1), c1=0; end;
if isempty(ci), ci=0; end;
if firstCall,   c1=[complex(1.0e0,0.0e0)];  end;
if firstCall,  ci=[complex(0.0e0,1.0e0)];  end;
if firstCall,   sqrt2=[.14142135623730950488e1];  end;
if firstCall,   sqrt3=[.17320508075688772935e1];  end;
if firstCall,   pi=[3.14159265358979323846e0];  end;
if firstCall,   c(1)=[complex(.121699028117870e+1,.326091563038355e+0)];  end;
if firstCall,   c(2)=[complex(.866025403784438e+0,.500000000000000e+0)];  end;
if firstCall,   c(3)=[complex(.520802437952465e+0,-.196048071390002e+1)];  end;
if firstCall,   c(4)=[complex(.599865470357589e+0,.113287925945897e+1)];  end;
if firstCall,   c(5)=[complex(.970930856437313e+0,-.113287925945897e+1)];  end;
if firstCall,   c(6)=[complex(.104999388884240e+1,.196048071389998e+1)];  end;
if firstCall,   c(7)=[complex(.313314753080534e-1,.541264220944095e-1)];  end;
if firstCall,   c(8)=[complex(-.785398163397449e+0,.658478948462413e+0)];  end;
if firstCall,   c(9)=[complex(-.785398163397449e+0,-.658478948462413e+0)];  end;
if firstCall,   c(10)=[complex(.785398163397449e+0,-.658478948462413e+0)];  end;
if firstCall,   c(11)=[complex(.313314753080534e-1,.541264220944095e-1)];  end;
if firstCall,   c(12)=[complex(-.313314753080534e-1,.541264220944095e-1)];  end;
if firstCall,   c(13)=[complex(.183048772171245e+1,.000000000000000e+0)];  end;
if firstCall,   c(14)=[complex(-.757236713834364e-1,-.961745759068982e+0)];  end;
if firstCall,   c(15)=[complex(-.813630257280238e-1,.103336966511721e+1)];  end;
if firstCall,   c(16)=[complex(.546302489843789e+0,.000000000000000e+0)];  end;
if firstCall,   c(17)=[complex(.150514997831990e+0,-.341094088460459e+0)];  end;
if firstCall,   c(18)=[complex(.301029995663980e+0,.227396058973639e+0)];  end;
if firstCall,   c(19)=[complex(.000000000000000e+0,.636619772367581e+0)];  end;
if firstCall,   c(20)=[complex(.137802461354738e+1,.909330673631480e+0)];  end;
if firstCall,   c(21)=[complex(.303123109082158e-1,-.244978663126864e+0)];  end;
if firstCall,   c(22)=[complex(.693147180559947e+0,.523598775598298e+0)];  end;
if firstCall,   c(23)=[complex(-.152857091948100e+1,.114371774040242e+1)];  end;
if firstCall,   c(24)=[complex(.144363547517882e+1,.157079632679490e+1)];  end;
if firstCall,   c(25)=[complex(-.100000000000000e+1,.000000000000000e+0)];  end;
if firstCall,   c(26)=[complex(.181878614736412e+1,.586225017697977e+0)];  end;
if firstCall,   c(27)=[complex(.402359478108525e+0,.101722196789785e+1)];  end;
if firstCall,   c(28)=[complex(.549306144334055e+0,-.157079632679490e+1)];  end;
if firstCall,   c(29)=[complex(.000000000000000e+0,-.117520119364380e+1)];  end;
if firstCall,   c(30)=[complex(-.642148124715515e+0,-.106860742138277e+1)];  end;
if firstCall,   c(31)=[complex(.397515306849130e+0,.104467701612914e+1)];  end;
if firstCall,   c(32)=[complex(-.117520119364380e+1,.000000000000000e+0)];  end;
if firstCall,   c(33)=[complex(-.116673625724091e+1,-.243458201185722e+0)];  end;
if firstCall,   c(34)=[complex(.761594155955766e+0,.000000000000000e+0)];  end;
if firstCall,   c(35)=[complex(.365427607174532e-1,-.612881308922810e-1)];  end;
if firstCall,   c(36)=[complex(.896860330225849e-2,.244804656578857e-1)];  end;
if firstCall,   c(37)=[complex(.177245385090552e+1,.000000000000000e+0)];  end;
if firstCall,   c(38)=[complex(.300694617260656e+0,-.424967879433124e+0)];  end;
if firstCall,   c(39)=[complex(.110951302025214e+1,-.156806064476794e+1)];  end;
if firstCall,   c(40)=[complex(.183074439659052e+1,.569607641036682e+0)];  end;
if firstCall,   c(41)=[complex(-.340863758923258e+1,.142127515954291e+1)];  end;
if firstCall,   c(42)=[complex(-.156059525546301e+1,.152533527872833e+1)];  end;
if firstCall,   c(43)=[complex(-.211272372936533e+0,-.765528316537801e+0)];  end;
if firstCall,   c(44)=[complex(.380273164249058e-1,-.286343074460341e+0)];  end;
if firstCall,   c(45)=[complex(-.268079774264798e+1,.130151697855085e+1)];  end;
if firstCall,   c(46)=[complex(-.164841998888369e+1,.785398163397448e+0)];  end;
if firstCall,   c(47)=[complex(-.196351002602143e+1,.000000000000000e+0)];  end;
if firstCall,   c(48)=[complex(.161278484461574e+1,.147079632679497e+1)];  end;
firstCall=0;
[w(1) ]=ccbrt(sqrt2.*(1.0e0+ci));
[w(2) ,ci]=ccbrt(ci);
[w(3) ]=cacos(pi+sqrt3.*ci);
[w(4) ]=cacos(sqrt2-.25e0.*pi.*ci);
[w(5) ]=casin(sqrt2-.25e0.*pi.*ci);
[w(6) ]=casin(pi+sqrt3.*ci);
[w(7) ]=catan(.3125e-1+.541265877365273e-1.*ci);
[w(8) ]=catan(-.5e0+.866025403784438e0.*ci);
[w(9) ,dumvar2,c1]=catan2(-.5e0-.866025403784438e0.*ci,c1);
[w(10) ,dumvar2,c1]=catan2(.5e0-.866025403784438e0.*ci,c1);
[w(11) ,dumvar2,c1]=catan2(.3125e-1+.541265877365273e-1.*ci,c1);
[w(12) ,dumvar2,c1]=catan2(-.3125e-1+.541265877365273e-1.*ci,c1);
[w(13) ]=ccot(.5e0+0.0e0.*ci);
[w(14) ]=ccot(-1.0e0+.5e0.*pi.*ci);
[w(15) ]=ctan(-1.0e0+.5e0.*pi.*ci);
[w(16) ]=ctan(.5e0+0.0e0.*ci);
[w(17) ]=clog10(1.0e0-ci);
[w(18) ]=clog10(sqrt3+ci);
[w(19) ]=cexprl(pi.*ci);
[w(20) ]=cexprl(1.0e0+ci);
[w(21) ]=clnrel(-.25e0.*ci);
[w(22) ]=clnrel(sqrt3-1.0e0+ci);
[w(23) ]=cacosh(1.0e0-2.0e0.*ci);
[w(24) ]=cacosh(2.0e0.*ci);
[w(25) ]=casinh(-.117520119364380e1+0.0e0.*ci);
[w(26) ]=casinh(2.5e0+1.75e0.*ci);
[w(27) ]=catanh(1.0e0+1.0e0.*ci);
[w(28) ]=catanh(2.0e0+0.0e0.*ci);
[w(29) ]=ccosh(1.0e0-.5e0.*pi.*ci);
[w(30) ]=ccosh(-1.0e0+2.0e0.*ci);
[w(31) ]=csinh(1.0e0-1.0e0./pi+ci);
[w(32) ]=csinh(1.0e0+pi.*ci);
[w(33) ]=ctanh(-1.0e0+2.0e0.*ci);
[w(34) ]=ctanh(1.0e0+pi.*ci);
[w(35) ]=c0lgmc(.5e0+.5e0.*ci);
[w(36) ]=c0lgmc(1.0e0-1.0e0.*ci);
[w(37) ]=cgamma(.5e0+0.0e0.*ci);
[w(38) ]=cgamma(.5e0+ci);
[w(39) ]=cgamr(.5e0-ci);
[w(40) ]=cgamr(1.0e0+ci);
[w(41) ]=clngam(1.1e0+3.2e0.*ci);
[w(42) ]=clngam(1.9e0+2.4e0.*ci);
[w(43) ]=cbeta(1.0e0+ci,1.0e0+ci);
[w(44) ]=cbeta(2.0e0-ci,.5e0+ci);
[w(45) ]=clbeta(2.0e0+ci,1.0e0-2.0e0.*ci);
[w(46) ]=clbeta(1.0e0-ci,2.0e0+ci);
[w(47) ]=cpsi(.5e0+0.0e0.*ci);
[w(48) ]=cpsi(1.0e0+5.0e0.*ci);
[errmax ]=r1mach(4);
errtol = sqrt(errmax);
for i = 1 : 48;
abserr = abs(c(i)-w(i));
relerr = abserr./abs(c(i));
errmax = max(relerr,errmax);
if( relerr>errtol && kprint>=2 )
writef(lun,[' For I  = ','%3i','  test fails with RELERR  = ','%38.30f','  and ABSERR  = ','%38.30f' ' \n'], i , relerr , abserr);
end;
%format (' For I  = ',i3,'  test fails with RELERR  = ',e38.30,'  and ABSERR  = ',e38.30);
end; i = fix(48+1);
ipass = 0;
if( errmax<=errtol )
ipass = 1;
end;
if( ipass~=0 && kprint>=2 )
writef(lun,[' Complex Fullerton special function routines o.k.' ' \n']);
end;
%format (' Complex Fullerton special function routines o.k.');
return;
end %subroutine cfnck

Contact us at files@mathworks.com