%% Verallgemeinerte Laguerre-Polynome

% Vers. 1.2 12/2011
%
% Simulation physikalischer Systeme - Computational Physics mit MATLAB 
% 2016
%%
%nr=3;
%l=1;
disp('n = 2*nr + l');
nr=input('Radiale Quantenzahl n_r  ');
l =input('Drehimpulsquantenzahl l  ');
%function Lpol2 = laguerrepolyfun(nr,l)
alpha = l+1/2;
if nr == 0
    Lpol2 = [0,1];
elseif nr == 1
    Lpol2 = [-1, 1 + alpha];
else
    Lpol1 =[zeros(1,nr),1];
    Lpol2 =[zeros(1,nr-1),-1,1+alpha];
    for k=1:nr-1
        mult2 = conv([-1,2*k+alpha+1],Lpol2);
        mult1 = (k+alpha)*Lpol1;
        mult2(1) = [];
        Lpol1 = Lpol2;
        Lpol2 = (mult2 - mult1)/(k+1);
    end
end

alphastr= strrep(num2str(alpha),'.','p');
eval(['L_',num2str(nr),'_',alphastr,' = ', 'Lpol2;'])
