02-15-2015, 11:59 AM
hi all,
I would write a little program to calculate "multinomial coefficient" (see here), as I cannot find it in the Prime's command list...
So, I need to input n (total number of objects) and a list of groups items (k_i) which sum is n.
Any hints to control user's input?
For now I tried this wrong program:
but this code give "Error: Bad argument type". More: the user must insert {} in the input (i.e. {1,4,4,2}) for the list.
Any hints to give user the possibility to input list without brackets?
About that, generally speaking, how to insert in Windows with HP Connectivity Kit, ∏LIST(), ∑LIST, ∆LIST? Connectivity Kit should have a way to insert special characters easily...
Also with the arrow -> used in apply(), map() and others commands: I insert it via shift-9 list but I get syntax error: I'm wrong, why?...
Thank you for help!
Salvo
I would write a little program to calculate "multinomial coefficient" (see here), as I cannot find it in the Prime's command list...
So, I need to input n (total number of objects) and a list of groups items (k_i) which sum is n.
Any hints to control user's input?
For now I tried this wrong program:
Code:
EXPORT Multinomial()
BEGIN
local n, k, x, list, multi;
input ({n, {k}}, "Multinomial Coefficient", {"n", "k_i list"}, {"Total n", "input {k_i list} with comma"}, {0,0});
list := apply(x-> x!, k);
multi := n!/∏LIST(list);
return multi;
END;
but this code give "Error: Bad argument type". More: the user must insert {} in the input (i.e. {1,4,4,2}) for the list.
Any hints to give user the possibility to input list without brackets?
About that, generally speaking, how to insert in Windows with HP Connectivity Kit, ∏LIST(), ∑LIST, ∆LIST? Connectivity Kit should have a way to insert special characters easily...
Also with the arrow -> used in apply(), map() and others commands: I insert it via shift-9 list but I get syntax error: I'm wrong, why?...
Thank you for help!
Salvo