function w=mtaylorweights(m,P)

allterms = factorial(m+P)/factorial(m)/factorial(P);
w = zeros(1,allterms);
w(1) = 1;

nxtterm = 2;
for p=1:P
    den = sym(factorial(p));
    
    vars = ones(1,p);
    weight = 1;
    while ~isempty(vars)
        
        w(nxtterm) = weight/den;
        
        [weight,vars] = nxtseqdf(vars,m);
        nxtterm = nxtterm+1;
    end;
    
end;

