Home > SPlaC v1_0 > Mie > SYM > SymScriptZnAll.m

SymScriptZnAll

PURPOSE ^

Script for symbolic expressions for the lowest orders Z_n functions and their small-argument Taylor expansions

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Script for symbolic expressions for the lowest orders Z_n functions and their small-argument Taylor expansions
 The Z_n functions are derived from the spherical Bessel functions as in Eq. H.35.
 The spherical Bessel function j and spherical Hankel function h1 are used here
 This script requires the Matlab symbolic toolbox to run.

 This file is part of the SPlaC v1.0 package (copyright 2008)
 Check the README file for further information

EXAMPLE OF OUTPUT ^

Example figure output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 nNmax=2;
0002 nTaylor=5;
0003 syms x positive; % use x real positive for better simplification
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); % [1 x nNmax+1]
0013 fjnm1=simplify(fjnm1.*sqmat);
0014 fh1nm1=simplify(fh1nm1.*sqmat);
0015 % fjnm1 and fh1nm1  are now matrix of spherical Bessel
0016 % j_n(rho), n=0..nNmax or equivalently j_{n-1}(rho), n=1..nNmax+1
0017 
0018 Z0j=fjnm1(2:(nNmax+1));
0019 Z1j=simplify(Z0j/x);
0020 Z2j=simplify(fjnm1(1:nNmax)-(1:nNmax).*Z1j);
0021 %Z2jcheck=simplify(diff(x*Z0j,x)/x);
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 %Z2h1check=simplify(factor(diff(x*Z0h1,x)/x));
0027 
0028 % Write output:
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 %    disp(['j:Z^2c_' int2str(n) '(x)= ' char(Z2jcheck(n))])
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 %    disp(['h1:Z^2c_' int2str(n) '(x)= exp(-i*x)* [' char(simple(Z2h1check(n)/(cos(x)-i*sin(x)))) ']'])
0041     disp(' ')
0042     disp(' ')
0043 end
0044 
0045 % Write output:
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 %    disp(['j:Z^1_' int2str(n) '(x)= x^' int2str(n-1) '* [' ...
0052 %        char(taylor(simplify(Z1j(n))/x^(n-1),nTaylor+2*n)) ']'])
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 %   disp(['h1:Z^1_' int2str(n) '(x)= 1/x^' int2str(n+2) '* [' ...
0059 %        char(taylor(simplify(factor(Z1h1(n))*(x^(n+2))),nTaylor,x)) ']'])
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

This web page is part of the SPlaC package © 2008. Contact: Eric Le Ru
Generated on Wed 03-Dec-2008 11:10:14 by m2html © 2003 (adapted)