The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Multinomial coefficient
02-15-2015, 11:59 AM (This post was last modified: 02-15-2015 05:49 PM by salvomic.)
Post: #1
Multinomial coefficient
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:
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

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Multinomial coefficient - salvomic - 02-15-2015 11:59 AM
RE: Multinomial coefficient - salvomic - 02-15-2015, 05:48 PM
RE: Multinomial coefficient - parisse - 02-15-2015, 07:44 PM
RE: Multinomial coefficient - salvomic - 02-15-2015, 08:20 PM
RE: Multinomial coefficient - salvomic - 02-15-2015, 09:25 PM



User(s) browsing this thread: 1 Guest(s)