function expand_kappa_lag1(kap,s,nmax) % --- COEFFICIENTS FOR THE EXPANSION OF KAPPA DISTN IN LAGUERRES % --- This illustrates the divergence of the expansion % Fig 4.8 with kap = 30 used nmax = 25 and scale factor s = 1 format long e xn=[1:1:nmax]; [pt,wt] = lagptwt(nmax); wtfcn=sqrt(pt).*exp(-pt); % Weight function spt=s*pt; % SCALE THE POINTS swt=s*wt./wtfcn'; % SCALE THE BIG WEIGHTS a=[]; p1=ones(1,nmax); a=[a p1']; % *** L_0(x) p2=1.5*ones(1,nmax)-spt'; a=[a p2']; % *** L_1(x) % --- L_n(x) BY RECURRENCE for n=3:nmax nm1=n-1; p3=(2*nm1-0.5-spt').*p2/nm1 - (nm1-.5)*p1/nm1; a=[a p3']; p1=p2; p2=p3; end kapp1=kap+1; norm=2*pi*gamma(kapp1)/((sqrt(pi*kapp1)^3)*gamma(kap-0.5)); %kappa=sqrt(spt)'.*(1/(1+spt./kapp1)).^kapp1; % *** Kappa distn for i=1:nmax kappa(i)=sqrt(spt(i))*(1/(1+spt(i)/kapp1))^kapp1; end % --- CALCULATE THE EXPANSION COEFFICIENTS BY QUADRATURE for n=1:nmax nm1=n-1; c(n)=sum(swt.*(kappa.*a(:,n)'))*factorial(nm1)/gamma(nm1+3/2); end % Plot the coefficients plot(xn(3:1:15),c(3:1:15),'-ok','linewidth',1.6,'markersize',7,'markerfacecolor','k') hold off %axis('FontSize', 24) axis([3 15 -.1 .2]) set(gca,'FontSize',15) set(gca,'Ytick',[-.1:.05:.2],'linewidth',1.6) set(gca,'Xtick',[3:3:15],'linewidth',1.6) %axis([-3 3 -1 1.2]) xlabel('$n$','Interpreter','LaTex','FontSize',30) ylabel('$c_n$','Interpreter','LaTex','FontSize',30) str1 = {'$\kappa = 30$'}; text(9,.15,str1,'Interpreter','Latex','Fontsize',26) end % Laguerre quadrature weights and points function [pt,wt] = lagptwt(n) xn=[0:1:n-1]; a=2*xn+3/2; b=(xn.*(xn+1/2)); % Recurrence coefficients rtb=sqrt(b); rtb(1)=[]; t=diag(rtb,-1)+diag(a)+diag(rtb,1); % Jacobi matrix [f,lambda]=eig(t); pt=diag(lambda); wt=gamma(3/2)*f(1,:).^2 ptwt=[pt,wt']; end