Code covered by the BSD License  

Highlights from
slatec

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

[x,ampl,theta]=d9b1mp(x,ampl,theta);
function [x,ampl,theta]=d9b1mp(x,ampl,theta);
persistent bm12cs bm1cs bt12cs bth1cs eta first firstCall nbm1 nbm12 nbt12 nbth1 pi4 xmax z ; if isempty(firstCall),firstCall=1;end; 

if isempty(eta), eta=0; end;
if isempty(nbm1), nbm1=0; end;
if isempty(nbm12), nbm12=0; end;
if isempty(nbt12), nbt12=0; end;
if isempty(nbth1), nbth1=0; end;
%***BEGIN PROLOGUE  D9B1MP
%***SUBSIDIARY
%***PURPOSE  Evaluate the modulus and phase for the J1 and Y1 Bessel
%            functions.
%***LIBRARY   SLATEC (FNLIB)
%***CATEGORY  C10A1
%***TYPE      doubleprecision (D9B1MP-D)
%***KEYWORDS  BESSEL FUNCTION, FNLIB, MODULUS, PHASE, SPECIAL FUNCTIONS
%***AUTHOR  Fullerton, W., (LANL)
%***DESCRIPTION
%
% Evaluate the modulus and phase for the Bessel J1 and Y1 functions.
%
% Series for BM1        on the interval  1.56250E-02 to  6.25000E-02
%                                        with weighted error   4.91E-32
%                                         log weighted error  31.31
%                               significant figures required  30.04
%                                    decimal places required  32.09
%
% Series for BT12       on the interval  1.56250E-02 to  6.25000E-02
%                                        with weighted error   3.33E-32
%                                         log weighted error  31.48
%                               significant figures required  31.05
%                                    decimal places required  32.27
%
% Series for BM12       on the interval  0.          to  1.56250E-02
%                                        with weighted error   5.01E-32
%                                         log weighted error  31.30
%                               significant figures required  29.99
%                                    decimal places required  32.10
%
% Series for BTH1       on the interval  0.          to  1.56250E-02
%                                        with weighted error   2.82E-32
%                                         log weighted error  31.55
%                               significant figures required  31.12
%                                    decimal places required  32.37
%
%***SEE ALSO  DBESJ1, DBESY1
%***REFERENCES  (NONE)
%***ROUTINES CALLED  D1MACH, DCSEVL, INITDS, XERMSG
%***REVISION HISTORY  (YYMMDD)
%   770701  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)
%   900720  Routine changed from user-callable to subsidiary.  (WRB)
%   920618  Removed space from variable name and code restructured to
%           use IF-THEN-ELSE.  (RWC, WRB)
%***end PROLOGUE  D9B1MP
if isempty(bm1cs), bm1cs=zeros(1,37); end;
if isempty(bt12cs), bt12cs=zeros(1,39); end;
if isempty(bm12cs), bm12cs=zeros(1,40); end;
if isempty(bth1cs), bth1cs=zeros(1,44); end;
if isempty(xmax), xmax=0; end;
if isempty(pi4), pi4=0; end;
if isempty(z), z=0; end;
if isempty(first), first=false; end;
if firstCall,   bm1cs(1)=[+.1069845452618063014969985308538d+0];  end;
if firstCall,   bm1cs(2)=[+.3274915039715964900729055143445d-2];  end;
if firstCall,   bm1cs(3)=[-.2987783266831698592030445777938d-4];  end;
if firstCall,   bm1cs(4)=[+.8331237177991974531393222669023d-6];  end;
if firstCall,   bm1cs(5)=[-.4112665690302007304896381725498d-7];  end;
if firstCall,   bm1cs(6)=[+.2855344228789215220719757663161d-8];  end;
if firstCall,   bm1cs(7)=[-.2485408305415623878060026596055d-9];  end;
if firstCall,   bm1cs(8)=[+.2543393338072582442742484397174d-10];  end;
if firstCall,   bm1cs(9)=[-.2941045772822967523489750827909d-11];  end;
if firstCall,   bm1cs(10)=[+.3743392025493903309265056153626d-12];  end;
if firstCall,   bm1cs(11)=[-.5149118293821167218720548243527d-13];  end;
if firstCall,   bm1cs(12)=[+.7552535949865143908034040764199d-14];  end;
if firstCall,   bm1cs(13)=[-.1169409706828846444166290622464d-14];  end;
if firstCall,   bm1cs(14)=[+.1896562449434791571721824605060d-15];  end;
if firstCall,   bm1cs(15)=[-.3201955368693286420664775316394d-16];  end;
if firstCall,   bm1cs(16)=[+.5599548399316204114484169905493d-17];  end;
if firstCall,   bm1cs(17)=[-.1010215894730432443119390444544d-17];  end;
if firstCall,   bm1cs(18)=[+.1873844985727562983302042719573d-18];  end;
if firstCall,   bm1cs(19)=[-.3563537470328580219274301439999d-19];  end;
if firstCall,   bm1cs(20)=[+.6931283819971238330422763519999d-20];  end;
if firstCall,   bm1cs(21)=[-.1376059453406500152251408930133d-20];  end;
if firstCall,   bm1cs(22)=[+.2783430784107080220599779327999d-21];  end;
if firstCall,   bm1cs(23)=[-.5727595364320561689348669439999d-22];  end;
if firstCall,   bm1cs(24)=[+.1197361445918892672535756799999d-22];  end;
if firstCall,   bm1cs(25)=[-.2539928509891871976641440426666d-23];  end;
if firstCall,   bm1cs(26)=[+.5461378289657295973069619199999d-24];  end;
if firstCall,   bm1cs(27)=[-.1189211341773320288986289493333d-24];  end;
if firstCall,   bm1cs(28)=[+.2620150977340081594957824000000d-25];  end;
if firstCall,   bm1cs(29)=[-.5836810774255685901920938666666d-26];  end;
if firstCall,   bm1cs(30)=[+.1313743500080595773423615999999d-26];  end;
if firstCall,   bm1cs(31)=[-.2985814622510380355332778666666d-27];  end;
if firstCall,   bm1cs(32)=[+.6848390471334604937625599999999d-28];  end;
if firstCall,   bm1cs(33)=[-.1584401568222476721192960000000d-28];  end;
if firstCall,   bm1cs(34)=[+.3695641006570938054301013333333d-29];  end;
if firstCall,   bm1cs(35)=[-.8687115921144668243012266666666d-30];  end;
if firstCall,   bm1cs(36)=[+.2057080846158763462929066666666d-30];  end;
if firstCall,   bm1cs(37)=[-.4905225761116225518523733333333d-31];  end;
if firstCall,   bt12cs(1)=[+.73823860128742974662620839792764d+0];  end;
if firstCall,   bt12cs(2)=[-.33361113174483906384470147681189d-2];  end;
if firstCall,   bt12cs(3)=[+.61463454888046964698514899420186d-4];  end;
if firstCall,   bt12cs(4)=[-.24024585161602374264977635469568d-5];  end;
if firstCall,   bt12cs(5)=[+.14663555577509746153210591997204d-6];  end;
if firstCall,   bt12cs(6)=[-.11841917305589180567005147504983d-7];  end;
if firstCall,   bt12cs(7)=[+.11574198963919197052125466303055d-8];  end;
if firstCall,   bt12cs(8)=[-.13001161129439187449366007794571d-9];  end;
if firstCall,   bt12cs(9)=[+.16245391141361731937742166273667d-10];  end;
if firstCall,   bt12cs(10)=[-.22089636821403188752155441770128d-11];  end;
if firstCall,   bt12cs(11)=[+.32180304258553177090474358653778d-12];  end;
if firstCall,   bt12cs(12)=[-.49653147932768480785552021135381d-13];  end;
if firstCall,   bt12cs(13)=[+.80438900432847825985558882639317d-14];  end;
if firstCall,   bt12cs(14)=[-.13589121310161291384694712682282d-14];  end;
if firstCall,   bt12cs(15)=[+.23810504397147214869676529605973d-15];  end;
if firstCall,   bt12cs(16)=[-.43081466363849106724471241420799d-16];  end;
if firstCall,   bt12cs(17)=[+.80202544032771002434993512550400d-17];  end;
if firstCall,   bt12cs(18)=[-.15316310642462311864230027468799d-17];  end;
if firstCall,   bt12cs(19)=[+.29928606352715568924073040554666d-18];  end;
if firstCall,   bt12cs(20)=[-.59709964658085443393815636650666d-19];  end;
if firstCall,   bt12cs(21)=[+.12140289669415185024160852650666d-19];  end;
if firstCall,   bt12cs(22)=[-.25115114696612948901006977706666d-20];  end;
if firstCall,   bt12cs(23)=[+.52790567170328744850738380799999d-21];  end;
if firstCall,   bt12cs(24)=[-.11260509227550498324361161386666d-21];  end;
if firstCall,   bt12cs(25)=[+.24348277359576326659663462400000d-22];  end;
if firstCall,   bt12cs(26)=[-.53317261236931800130038442666666d-23];  end;
if firstCall,   bt12cs(27)=[+.11813615059707121039205990399999d-23];  end;
if firstCall,   bt12cs(28)=[-.26465368283353523514856789333333d-24];  end;
if firstCall,   bt12cs(29)=[+.59903394041361503945577813333333d-25];  end;
if firstCall,   bt12cs(30)=[-.13690854630829503109136383999999d-25];  end;
if firstCall,   bt12cs(31)=[+.31576790154380228326413653333333d-26];  end;
if firstCall,   bt12cs(32)=[-.73457915082084356491400533333333d-27];  end;
if firstCall,   bt12cs(33)=[+.17228081480722747930705920000000d-27];  end;
if firstCall,   bt12cs(34)=[-.40716907961286507941068800000000d-28];  end;
if firstCall,   bt12cs(35)=[+.96934745136779622700373333333333d-29];  end;
if firstCall,   bt12cs(36)=[-.23237636337765716765354666666666d-29];  end;
if firstCall,   bt12cs(37)=[+.56074510673522029406890666666666d-30];  end;
if firstCall,   bt12cs(38)=[-.13616465391539005860522666666666d-30];  end;
if firstCall,   bt12cs(39)=[+.33263109233894654388906666666666d-31];  end;
if firstCall,   bm12cs(1)=[+.9807979156233050027272093546937d-1];  end;
if firstCall,   bm12cs(2)=[+.1150961189504685306175483484602d-2];  end;
if firstCall,   bm12cs(3)=[-.4312482164338205409889358097732d-5];  end;
if firstCall,   bm12cs(4)=[+.5951839610088816307813029801832d-7];  end;
if firstCall,   bm12cs(5)=[-.1704844019826909857400701586478d-8];  end;
if firstCall,   bm12cs(6)=[+.7798265413611109508658173827401d-10];  end;
if firstCall,   bm12cs(7)=[-.4958986126766415809491754951865d-11];  end;
if firstCall,   bm12cs(8)=[+.4038432416421141516838202265144d-12];  end;
if firstCall,   bm12cs(9)=[-.3993046163725175445765483846645d-13];  end;
if firstCall,   bm12cs(10)=[+.4619886183118966494313342432775d-14];  end;
if firstCall,   bm12cs(11)=[-.6089208019095383301345472619333d-15];  end;
if firstCall,   bm12cs(12)=[+.8960930916433876482157048041249d-16];  end;
if firstCall,   bm12cs(13)=[-.1449629423942023122916518918925d-16];  end;
if firstCall,   bm12cs(14)=[+.2546463158537776056165149648068d-17];  end;
if firstCall,   bm12cs(15)=[-.4809472874647836444259263718620d-18];  end;
if firstCall,   bm12cs(16)=[+.9687684668292599049087275839124d-19];  end;
if firstCall,   bm12cs(17)=[-.2067213372277966023245038117551d-19];  end;
if firstCall,   bm12cs(18)=[+.4646651559150384731802767809590d-20];  end;
if firstCall,   bm12cs(19)=[-.1094966128848334138241351328339d-20];  end;
if firstCall,   bm12cs(20)=[+.2693892797288682860905707612785d-21];  end;
if firstCall,   bm12cs(21)=[-.6894992910930374477818970026857d-22];  end;
if firstCall,   bm12cs(22)=[+.1830268262752062909890668554740d-22];  end;
if firstCall,   bm12cs(23)=[-.5025064246351916428156113553224d-23];  end;
if firstCall,   bm12cs(24)=[+.1423545194454806039631693634194d-23];  end;
if firstCall,   bm12cs(25)=[-.4152191203616450388068886769801d-24];  end;
if firstCall,   bm12cs(26)=[+.1244609201503979325882330076547d-24];  end;
if firstCall,   bm12cs(27)=[-.3827336370569304299431918661286d-25];  end;
if firstCall,   bm12cs(28)=[+.1205591357815617535374723981835d-25];  end;
if firstCall,   bm12cs(29)=[-.3884536246376488076431859361124d-26];  end;
if firstCall,   bm12cs(30)=[+.1278689528720409721904895283461d-26];  end;
if firstCall,   bm12cs(31)=[-.4295146689447946272061936915912d-27];  end;
if firstCall,   bm12cs(32)=[+.1470689117829070886456802707983d-27];  end;
if firstCall,   bm12cs(33)=[-.5128315665106073128180374017796d-28];  end;
if firstCall,   bm12cs(34)=[+.1819509585471169385481437373286d-28];  end;
if firstCall,   bm12cs(35)=[-.6563031314841980867618635050373d-29];  end;
if firstCall,   bm12cs(36)=[+.2404898976919960653198914875834d-29];  end;
if firstCall,   bm12cs(37)=[-.8945966744690612473234958242979d-30];  end;
if firstCall,   bm12cs(38)=[+.3376085160657231026637148978240d-30];  end;
if firstCall,   bm12cs(39)=[-.1291791454620656360913099916966d-30];  end;
if firstCall,   bm12cs(40)=[+.5008634462958810520684951501254d-31];  end;
if firstCall,   bth1cs(1)=[+.74749957203587276055443483969695d+0];  end;
if firstCall,   bth1cs(2)=[-.12400777144651711252545777541384d-2];  end;
if firstCall,   bth1cs(3)=[+.99252442404424527376641497689592d-5];  end;
if firstCall,   bth1cs(4)=[-.20303690737159711052419375375608d-6];  end;
if firstCall,   bth1cs(5)=[+.75359617705690885712184017583629d-8];  end;
if firstCall,   bth1cs(6)=[-.41661612715343550107630023856228d-9];  end;
if firstCall,   bth1cs(7)=[+.30701618070834890481245102091216d-10];  end;
if firstCall,   bth1cs(8)=[-.28178499637605213992324008883924d-11];  end;
if firstCall,   bth1cs(9)=[+.30790696739040295476028146821647d-12];  end;
if firstCall,   bth1cs(10)=[-.38803300262803434112787347554781d-13];  end;
if firstCall,   bth1cs(11)=[+.55096039608630904934561726208562d-14];  end;
if firstCall,   bth1cs(12)=[-.86590060768383779940103398953994d-15];  end;
if firstCall,   bth1cs(13)=[+.14856049141536749003423689060683d-15];  end;
if firstCall,   bth1cs(14)=[-.27519529815904085805371212125009d-16];  end;
if firstCall,   bth1cs(15)=[+.54550796090481089625036223640923d-17];  end;
if firstCall,   bth1cs(16)=[-.11486534501983642749543631027177d-17];  end;
if firstCall,   bth1cs(17)=[+.25535213377973900223199052533522d-18];  end;
if firstCall,   bth1cs(18)=[-.59621490197413450395768287907849d-19];  end;
if firstCall,   bth1cs(19)=[+.14556622902372718620288302005833d-19];  end;
if firstCall,   bth1cs(20)=[-.37022185422450538201579776019593d-20];  end;
if firstCall,   bth1cs(21)=[+.97763074125345357664168434517924d-21];  end;
if firstCall,   bth1cs(22)=[-.26726821639668488468723775393052d-21];  end;
if firstCall,   bth1cs(23)=[+.75453300384983271794038190655764d-22];  end;
if firstCall,   bth1cs(24)=[-.21947899919802744897892383371647d-22];  end;
if firstCall,   bth1cs(25)=[+.65648394623955262178906999817493d-23];  end;
if firstCall,   bth1cs(26)=[-.20155604298370207570784076869519d-23];  end;
if firstCall,   bth1cs(27)=[+.63417768556776143492144667185670d-24];  end;
if firstCall,   bth1cs(28)=[-.20419277885337895634813769955591d-24];  end;
if firstCall,   bth1cs(29)=[+.67191464220720567486658980018551d-25];  end;
if firstCall,   bth1cs(30)=[-.22569079110207573595709003687336d-25];  end;
if firstCall,   bth1cs(31)=[+.77297719892989706370926959871929d-26];  end;
if firstCall,   bth1cs(32)=[-.26967444512294640913211424080920d-26];  end;
if firstCall,   bth1cs(33)=[+.95749344518502698072295521933627d-27];  end;
if firstCall,   bth1cs(34)=[-.34569168448890113000175680827627d-27];  end;
if firstCall,   bth1cs(35)=[+.12681234817398436504211986238374d-27];  end;
if firstCall,   bth1cs(36)=[-.47232536630722639860464993713445d-28];  end;
if firstCall,   bth1cs(37)=[+.17850008478186376177858619796417d-28];  end;
if firstCall,   bth1cs(38)=[-.68404361004510395406215223566746d-29];  end;
if firstCall,   bth1cs(39)=[+.26566028671720419358293422672212d-29];  end;
if firstCall,   bth1cs(40)=[-.10450402527914452917714161484670d-29];  end;
if firstCall,   bth1cs(41)=[+.41618290825377144306861917197064d-30];  end;
if firstCall,   bth1cs(42)=[-.16771639203643714856501347882887d-30];  end;
if firstCall,   bth1cs(43)=[+.68361997776664389173535928028528d-31];  end;
if firstCall,   bth1cs(44)=[-.28172247861233641166739574622810d-31];  end;
if firstCall,   pi4=[0.785398163397448309615660845819876d0];  end;
if firstCall,   first=[true];  end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT  D9B1MP
if( first )
eta = 0.1.*real(d1mach(3));
[nbm1 ,bm1cs,dumvar3,eta]=initds(bm1cs,37,eta);
[nbt12 ,bt12cs,dumvar3,eta]=initds(bt12cs,39,eta);
[nbm12 ,bm12cs,dumvar3,eta]=initds(bm12cs,40,eta);
[nbth1 ,bth1cs,dumvar3,eta]=initds(bth1cs,44,eta);
%
xmax = 1.0d0./d1mach(4);
end;
first = false;
%
if( x<4.0d0 )
xermsg('SLATEC','D9B1MP','X must be .GE. 4',1,2);
ampl = 0.0d0;
theta = 0.0d0;
elseif( x<=8.0d0 ) ;
z =(128.0d0./(x.*x)-5.0d0)./3.0d0;
ampl =(0.75d0+dcsevl(z,bm1cs,nbm1))./sqrt(x);
theta = x - 3.0d0.*pi4 + dcsevl(z,bt12cs,nbt12)./x;
else;
if( x>xmax )
xermsg('SLATEC','D9B1MP','No precision because X is too big',2,2);
end;
%
z = 128.0d0./(x.*x) - 1.0d0;
ampl =(0.75d0+dcsevl(z,bm12cs,nbm12))./sqrt(x);
theta = x - 3.0d0.*pi4 + dcsevl(z,bth1cs,nbth1)./x;
end;
end
%DECK D9CHU

Contact us at files@mathworks.com