Documentation/Calc Functions/MULTINOMIAL

    From The Document Foundation Wiki


    Function name:

    MULTINOMIAL

    Category:

    Mathematical

    Summary:

    Calculates a multinomial coefficient for the given set of positive integers. Computes the factorial of the sum of those numbers and divides by the product of their individual factorials.

    Syntax:

    MULTINOMIAL(Number 1 [; Number 2 [; … [; Number 255]]])

    Returns:

    Returns a positive integer that is the multinomial coefficient for the given data.

    Arguments:

    Number 1, Number 2, … , Number 255 give the set of values for which the multinomial coefficient is to be calculated. At least one value must be provided.

    Each argument may take one of the following forms:

    • A positive integer, or an expression that evaluates to a positive integer.
    • A reference to a single cell containing a positive integer.
    • A simple reference to a cell range containing positive integers (for example, A1:B9).
    • The name of a named range, comprising cells containing positive integers.
    • The name of a database range, comprising cells containing positive integers.
    • An inline array of positive integers (for example, {1; 2; 3; 4}).

    Note that although MULTINOMIAL can accept up to 255 arguments, each argument could specify a range of cells. This means that the number of positive integers processed could be many more than 255. Beware however that MULTINOMIAL can return very large values from relatively small argument values – for example, the formula =MULTINOMIAL(7; 8; 9) returns the value 8413788240.

    The following conditions (including errors) may be encountered:

    • If any argument is a string in quotation marks, or a reference to a single cell that contains a string rather than a positive integer, then MULTINOMIAL reports an error. This will be either a #VALUE! error or an invalid argument error (Err:502), depending on the values of other arguments.
    • Text and empty cells within a data range are ignored.
    • If any value is less than or equal to −1, then MULTINOMIAL reports an invalid argument error (Err:502). Values within the range −1 < x < 0 are rounded up to 0 (zero).
    • If any positive value is not an integer, that value is truncated to its floor value.
    • If after any truncation all supplied values are equal to 0, then MULTINOMIAL returns the value 1.

    Additional details:

    • MULTINOMIAL ignores any text or empty cells within a data range. If you suspect wrong results, look for text within the supplied data range(s). To highlight text content within a data range, use Calc's View ▸ Value Highlighting feature.
    • For the set of k values N1Nk, MULTINOMIAL implements the following formula:

    [math]\displaystyle{ \text{MULTINOMIAL}(N_1; N_2; ...; N_k)~=~\frac{(N_1+N_2+ ... +N_k)!}{N_1! \times N_2!\times ... \times N_k!} }[/math]

    Examples:

    Data for examples
    A B C D
    1
    2 2 3 4
    Formula Description Returns
    =MULTINOMIAL(1; 2) [math]\displaystyle{ \left(\frac{(1+2)!}{1!\times2!}\right) }[/math] 3
    =MULTINOMIAL(1; 2; 3) [math]\displaystyle{ \left(\frac{(1+2+3)!}{1!\times2!\times3!}\right) }[/math] 60

    =MULTINOMIAL(B2:D2)

    =MULTINOMIAL(B2; C2; D2)

    [math]\displaystyle{ \left(\frac{(2+3+4)!}{2!\times3!\times4!}\right) }[/math] 1260

    =MULTINOMIAL(4.4; 5.5; 6.6)

    =MULTINOMIAL(4; 5; 6)

    The three argument values are truncated to 4, 5, and 6 respectively. [math]\displaystyle{ \left(\frac{(4+5+6)!}{4!\times5!\times6!}\right) }[/math]

    630630
    =MULTINOMIAL ({7; 6; 1; 0}) [math]\displaystyle{ \left(\frac{(7+6+1+0)!}{7!\times6!\times1!\times0!}\right) }[/math] 24024

    Related LibreOffice functions:

    FACT

    ODF standard:

    Section 6.16.43, part 2

    Related (or similar) Excel functions:

    MULTINOMIAL