Script for symbolic expressions for the lowest orders p_n and t_n angular functions p_n and t_n relates to the angular dependence for m=0 (used for perpendicular dipoles). They are defined and discussed in the SPlaC supplementary information. 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
0001 nNmax=8; 0002 syms t positive; % t for theta 0003 0004 % This code follows the method of DipPinTaunPnTn 0005 nrows=1; % only one theta here, T=1 0006 muc=cos(t); 0007 mus=sin(t); 0008 0009 % Initialize recurrence p_0=1, p_1=muc, t_0=0, t_1=-mus 0010 % pnm1 contains p_{n-1} n=1..nNmax+1, same for tnm1 0011 pnm1=t*zeros(nrows,nNmax+1)+1; % [T x N+1] 0012 pnm1(:,2)=muc; % [T x 1] 0013 tnm1=t*zeros(nrows,nNmax+1); % [T x N+1] 0014 tnm1(:,2)=-mus; % [T x 1] 0015 0016 % Get p_2 to p_nNmax and t_2 to t_nNmax by recurrence 0017 % p_n is pnm1(:,n+1), t_n is tnm1(:,n+1) 0018 for n=2:(nNmax) 0019 pnm1(:,n+1)=(2*n-1)/(n)*muc.*pnm1(:,n)-(n-1)/n*pnm1(:,n-1); 0020 tnm1(:,n+1)=muc.*tnm1(:,n)-n*mus.*pnm1(:,n); 0021 end; 0022 0023 % return p_n and t_n matrices (except n=0) 0024 pn=pnm1(:,2:(nNmax+1)); 0025 tn=tnm1(:,2:(nNmax+1)); 0026 0027 % Write output: 0028 disp(' ') 0029 for n=1:(nNmax) 0030 disp(['p_' int2str(n) '(t)= ' char(factor(pn(1,n)))]) 0031 disp(['t_' int2str(n) '(t)= ' char(factor(tn(1,n)))]) 0032 disp(' ') 0033 end;