0001 nNmax=2;
0002 nTaylor=5;
0003 syms x positive;
0004
0005 nm1=0:nNmax;
0006 nu=nm1+0.5;
0007
0008 fjnm1=besselj(nu,x);
0009 fh1nm1=fjnm1+i*bessely(nu,x);
0010
0011 sq=sqrt((pi/2)/x);
0012 sqmat=repmat(sq,1,nNmax+1);
0013 fjnm1=simplify(fjnm1.*sqmat);
0014 fh1nm1=simplify(fh1nm1.*sqmat);
0015
0016
0017
0018 Z0j=fjnm1(2:(nNmax+1));
0019 Z1j=simplify(Z0j/x);
0020 Z2j=simplify(fjnm1(1:nNmax)-(1:nNmax).*Z1j);
0021
0022
0023 Z0h1=simplify(factor(fh1nm1(2:(nNmax+1))));
0024 Z1h1=simplify(factor(Z0h1/x));
0025 Z2h1=simplify(factor(fh1nm1(1:nNmax)-(1:nNmax).*Z1h1));
0026
0027
0028
0029 disp('Functions:')
0030 disp(' ')
0031 for n=1:(nNmax)
0032 disp(['j:Z^0_' int2str(n) '(x)= ' char(Z0j(n))])
0033 disp(['j:Z^1_' int2str(n) '(x)= ' char(Z1j(n))])
0034 disp(['j:Z^2_' int2str(n) '(x)= ' char(Z2j(n))])
0035
0036 disp(' ')
0037 disp(['h1:Z^0_' int2str(n) '(x)= exp(i*x)* [' char(simple(Z0h1(n)/(cos(x)+i*sin(x)))) ']'])
0038 disp(['h1:Z^1_' int2str(n) '(x)= exp(i*x)* [' char(simple(Z1h1(n)/(cos(x)+i*sin(x)))) ']'])
0039 disp(['h1:Z^2_' int2str(n) '(x)= exp(i*x)* [' char(simple(Z2h1(n)/(cos(x)+i*sin(x)))) ']'])
0040
0041 disp(' ')
0042 disp(' ')
0043 end
0044
0045
0046 disp('Taylor expansions around x=0:')
0047 disp(' ')
0048 for n=1:(nNmax)
0049 disp(['j:Z^0_' int2str(n) '(x)= x^' int2str(n) '* [' ...
0050 char(taylor(simplify(Z0j(n))/x^(n),nTaylor+2*n+1)) ']'])
0051
0052
0053 disp(['j:Z^2_' int2str(n) '(x)= x^' int2str(n-1) '* [' ...
0054 char(taylor(simplify(Z2j(n))/x^(n-1),nTaylor+2*n+1)) ']'])
0055 disp(' ')
0056 disp(['h1:Z^0_' int2str(n) '(x)= 1/x^' int2str(n+1) '* [' ...
0057 char(taylor(simplify(factor(Z0h1(n))*(x^(n+1))),nTaylor,x)) ']'])
0058
0059
0060 disp(['h1:Z^2_' int2str(n) '(x)= 1/x^' int2str(n+2) '* [' ...
0061 char(taylor(simplify(factor(Z2h1(n))*(x^(n+2))),nTaylor,x)) ']'])
0062 disp(' ')
0063 disp(' ')
0064 end
0065