% MM_JACOBILOG Modified moments for a logarithmic weight function
%
%    The call mm=MM_JACOBILOG(n,a,b) computes the first n modified
%    moments of the logarithmic weight function 
%             w(t)=(1-t)^a*t^b*log(1/t)  on  [0,1]
%    relative to shifted monic Jacobi polynomials P^{*(a,b)}_n.
%
%    REFERENCE: L. Gatteschi, ``On some orthogonal polynomial
%    integral'', Math. Comp. 35 (1980), 1291-1298, Eq. (2.2).
%    [Note, however, that the modified moments in this reference
%    are relative to standard (not monic) Jacobi polynomials.]
%
function mm=mm_jacobilog(N,a,b)
if nargin<2, a=0; end; if nargin<3, b=a; end
if((N<=0)|(a<=-1)|(b<=-1)) error('parameter(s) out of range'), end
mm(1)=gamma(a+1)*gamma(b+1)*(psi(a+b+2)-psi(b+1))/gamma(a+b+2);
if N==1, return, end;
m=-gamma(a+2)*gamma(b+1)/gamma(a+b+3); mm(2)=m/(a+b+2);
if N==2, return, end;
for n=3:N
  m=-(n-2)*(n+a-1)*m/((2*n+a+b-2)*(2*n+a+b-3));
  mm(n)=m/(n+a+b);
end
