Difference between revisions of "Documentation/How Tos/Calc: COMBINA function"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
(corrected formula and description error propagated from the Help file.)
Line 2: Line 2:
  
 
== COMBINA ==
 
== COMBINA ==
Returns the number of ordered combinations of a subset of items.
+
Returns the number of combinations of a subset of items.
  
 
=== Syntax: ===
 
=== Syntax: ===
<tt>'''COMBINA(setsize; subsetsize)'''</tt>
+
<tt>'''COMBINA(n; k)'''</tt>
: <tt>'''setsize'''</tt> is the number of items in the set.
+
: <tt>'''n'''</tt> is the number of items in the set.
  
: <tt>'''subsetsize'''</tt> is the number of items to choose from the set.
+
: <tt>'''k'''</tt> is the number of items to choose from the set.
  
: <tt>'''COMBINA'''</tt> returns the number of ways to choose these items, where the order of choosing is important. For example if there are 3 items A, B and C in a set, you can choose 2 items in 6 different ways, namely AB, BA, AC, CA, BC and CB.
+
: <tt>'''COMBINA'''</tt> returns the number of unique ways to choose these items, where the order of choosing is irrelevant, and repetition of items is allowed. For example if there are 3 items A, B and C in a set, you can choose 2 items in 6 different ways, namely AA, AB, AC, BB, BC and CC; you can choose 3 items in 10 different ways, namely AAA, AAB, AAC, ABB, ABC, ACC, BBB, BBC, BCC, CCC.
  
 
: <tt>'''COMBINA'''</tt> implements the formula:
 
: <tt>'''COMBINA'''</tt> implements the formula:
  
:: <tt>'''setsize!/(setsize-subsetsize)!'''</tt>
+
:: <tt>'''(''n''+''k''-1)!/(''k''!(''n''-1)!)'''</tt>
  
 
=== Example: ===
 
=== Example: ===
 
<tt>'''COMBINA(3,2)'''</tt>
 
<tt>'''COMBINA(3,2)'''</tt>
 
: returns <tt>'''6'''</tt>.
 
: returns <tt>'''6'''</tt>.
 +
 +
<tt>'''COMBINA(3,3)'''</tt>
 +
: returns <tt>'''10'''</tt>.
  
 
=== See also: ===
 
=== See also: ===
'''[[Documentation/How_Tos/Calc: COMBIN function|COMBIN]]'''
+
'''[[Documentation/How_Tos/Calc: COMBIN function|COMBIN]]''',
 +
'''[[Documentation/How_Tos/Calc: PERMUT function|PERMUT]]''',
 +
'''[[Documentation/How_Tos/Calc: PERMUTATIONA function|PERMUTATIONA]]'''
  
 
'''[[Documentation/How_Tos/Calc: Mathematical functions|Mathematical functions]]'''
 
'''[[Documentation/How_Tos/Calc: Mathematical functions|Mathematical functions]]'''

Revision as of 12:52, 8 April 2008


COMBINA

Returns the number of combinations of a subset of items.

Syntax:

COMBINA(n; k)

n is the number of items in the set.
k is the number of items to choose from the set.
COMBINA returns the number of unique ways to choose these items, where the order of choosing is irrelevant, and repetition of items is allowed. For example if there are 3 items A, B and C in a set, you can choose 2 items in 6 different ways, namely AA, AB, AC, BB, BC and CC; you can choose 3 items in 10 different ways, namely AAA, AAB, AAC, ABB, ABC, ACC, BBB, BBC, BCC, CCC.
COMBINA implements the formula:
(n+k-1)!/(k!(n-1)!)

Example:

COMBINA(3,2)

returns 6.

COMBINA(3,3)

returns 10.

See also:

COMBIN, PERMUT, PERMUTATIONA

Mathematical functions

Personal tools