RosettaCodeData/Task/Evaluate-binomial-coefficients/MATLAB/evaluate-binomial-coefficie...

41 lines
564 B
Mathematica

>> binomialCoeff((0:5),(0:5))
ans =
1 0 0 0 0 0
1 1 0 0 0 0
1 2 1 0 0 0
1 3 3 1 0 0
1 4 6 4 1 0
1 5 10 10 5 1
>> binomialCoeff([1 0 3 2],(0:3))
ans =
1 1 0 0
1 0 0 0
1 3 3 1
1 2 1 0
>> binomialCoeff(3,(0:3))
ans =
1 3 3 1
>> binomialCoeff((0:3),2)
ans =
0
0
1
3
>> binomialCoeff(5,3)
ans =
10