I want to calculate the multinomial coefficient:
where it is satisifed
using the tip provided by @jemidiah,
and here is the code
function c = multicoeff (k),
c = 1;
for i=1:length(k),
c = c* bincoeff(sum(k(1:i)),k(i));
end;
end
and some usage examples:
octave:88> multicoeff([2 2 2])
ans = 90
octave:89> factorial(6)/(factorial(2)*factorial(2)*factorial(2))
ans = 90
octave:90> multicoeff([5 4 3])
ans = 27720
octave:91> factorial(12)/(factorial(5)*factorial(4)*factorial(3))
ans = 27720