Question: How do I add and multiply combinations of numbers?

This should be simple but I am missing something. I want to sum the product of combinations of numbers.

I know I can assign values to a0...a[n-1]. But that isn't nice.

 

(n,k):= (5,4);
add(mul~(combinat:-choose([a(||)[](0..n-1)], k))) ; =a0*a1*a2*a3+a0*a1*a2*a4+a0*a1*a3*a4+a0*a2*a3*a4+a1*a2*a3*a4  which is correct.
add(mul~(combinat:-choose([(0..n-1)], k))) ;   #should be 24 but I get 0

 

Please Wait...