OpenMath Content Dictionary: combinat1
Canonical URL:
http://www.openmath.org/cd/combinat1.ocd
CD Base:
http://www.openmath.org/cd
CD File:
combinat1.ocd
CD as XML Encoded OpenMath:
combinat1.omcd
Defines:
Bell , binomial , Fibonacci , multinomial , Stirling1 , Stirling2
Date:
2004-03-30
Version:
3
Review Date:
2006-03-30
Status:
experimental
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The copyright holder grants you permission to redistribute this
document freely as a verbatim copy. Furthermore, the copyright
holder permits you to develop any derived work from this document
provided that the following conditions are met.
a) The derived work acknowledges the fact that it is derived from
this document, and maintains a prominent reference in the
work to the original source.
b) The fact that the derived work is not the original OpenMath
document is stated prominently in the derived work. Moreover if
both this document and the derived work are Content Dictionaries
then the derived work must include a different CDName element,
chosen so that it cannot be confused with any works adopted by
the OpenMath Society. In particular, if there is a Content
Dictionary Group whose name is, for example, `math' containing
Content Dictionaries named `math1', `math2' etc., then you should
not name a derived Content Dictionary `mathN' where N is an integer.
However you are free to name it `private_mathN' or some such. This
is because the names `mathN' may be used by the OpenMath Society
for future extensions.
c) The derived work is distributed under terms that allow the
compilation of derived works, but keep paragraphs a) and b)
intact. The simplest way to do this is to distribute the derived
work under the OpenMath license, but this is not a requirement.
If you have questions about this license please contact the OpenMath
society at http://www.openmath.org.
This CD defines some basic combinatorics definitions.
Written by S. Dalmas (INRIA Sophia Antipolis) for the Esprit OpenMath
project.
Role:
application
Description:
The binomial coefficients. binomial(n, m) is the number of ways of choosing m
objects from a collection of n distinct objects without regard to the order.
Commented Mathematical property (CMP):
binomial(n,m) = n!/(m!*(n-m)!)
Formal Mathematical property (FMP):
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="binomial"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
<OMA>
<OMS cd="arith1" name="divide"/>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMV name="n"/>
</OMA>
<OMA>
<OMS cd="arith1" name="times"/>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMV name="m"/>
</OMA>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
</OMA>
</OMA>
</OMA>
</OMA>
</OMOBJ>
n
m
=
n
!
m
!
(
n
-
m
)
!
Example:
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="binomial"/>
<OMI> 4 </OMI>
<OMI> 2 </OMI>
</OMA>
<OMI> 6 </OMI>
</OMA>
</OMOBJ>
4
2
=
6
Signatures:
sts
Role:
application
Description:
The multinomial coefficient, multinomial(n, n1, ... nk) is the number of
ways of choosing ni objects of type i (i from 1 to k) without regard to
order, in such a way that the total number of objects chosen is n.
multinomial(n, n1, ... nk) is equal to n!/(n1!*n2! ...*nk!).
Commented Mathematical property (CMP):
multinomial(n, n1, ... nk) is equal to n!/(n1!*n2! ...*nk!) where n=n1+...+nk
Formal Mathematical property (FMP):
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="fns2" name="apply_to_list"/>
<OMS cd="combinat1" name="multinomial"/>
<OMA>
<OMS cd="list2" name="cons"/>
<OMV name="n"/>
<OMV name="nList"/>
</OMA>
</OMA>
<OMA>
<OMS cd="arith1" name="divide"/>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMV name="n"/>
</OMA>
<OMA>
<OMS cd="fns2" name="apply_to_list"/>
<OMS cd="arith1" name="times"/>
<OMV name="nList2"/>
</OMA>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="linalg1" name="vector_selector"/>
<OMV name="i"/>
<OMA>
<OMS cd="fns2" name="apply_to_list"/>
<OMS cd="linalg2" name="vector"/>
<OMV name="nlist2"/>
</OMA>
</OMA>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMA>
<OMS cd="linalg1" name="vector_selector"/>
<OMV name="i"/>
<OMA>
<OMS cd="fns2" name="apply_to_list"/>
<OMS cd="linalg2" name="vector"/>
<OMV name="nList"/>
</OMA>
</OMA>
</OMA>
</OMA>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMV name="n"/>
<OMA>
<OMS cd="fns2" name="apply_to_list"/>
<OMS cd="arith1" name="plus"/>
<OMV name="nList"/>
</OMA>
</OMA>
</OMA>
</OMOBJ>
and
(
eq
(
apply_to_list
(
multinomial ,
cons
(
n ,
nList )
)
,
divide
(
factorial
(
n )
,
apply_to_list
(
times ,
nList2 )
)
)
,
eq
(
vector_selector
(
i ,
apply_to_list
(
vector ,
nlist2 )
)
,
factorial
(
vector_selector
(
i ,
apply_to_list
(
vector ,
nList )
)
)
)
,
eq
(
n ,
apply_to_list
(
plus ,
nList )
)
)
apply_to_list
(
cons
(
n
,
nList
)
,
cons
(
n
,
nList
)
)
=
n
!
apply_to_list
(
×
,
nList
2
)
∧
apply_to_list
(
vector
,
nlist
2
)
i
=
apply_to_list
(
vector
,
nList
)
i
!
∧
n
=
apply_to_list
(
+
,
nList
)
Example:
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="multinomial"/>
<OMI> 8 </OMI>
<OMI> 2 </OMI>
<OMI> 3 </OMI>
<OMI> 3 </OMI>
</OMA>
<OMI> 560 </OMI>
</OMA>
</OMOBJ>
8
2
3
3
=
560
Signatures:
sts
Role:
application
Description:
The Stirling numbers of the first kind. (-1)^(n-m)*Stirling1(n,m) is the
number of permutations of n symbols which have exactly m cycles.
Note that there are a few slightly different definitions of these numbers.
Commented Mathematical property (CMP):
Stirling1(n,m) = the sum k=0 to n-m of (-1)^k * binomial(n-1+k, n-m+k) *
binomial(2n-m,n-m-k) * Stirling2(n,m)
Formal Mathematical property (FMP):
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Stirling1"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMS cd="alg1" name="zero"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="k"/>
</OMBVAR>
<OMA>
<OMS cd="arith1" name="times"/>
<OMA>
<OMS cd="arith1" name="power"/>
<OMA>
<OMS cd="arith1" name="unary_minus"/>
<OMS cd="alg1" name="one"/>
</OMA>
<OMV name="k"/>
</OMA>
<OMA>
<OMS cd="combinat1" name="binomial"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="n"/>
<OMS cd="alg1" name="one"/>
</OMA>
<OMV name="k"/>
</OMA>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
<OMV name="k"/>
</OMA>
</OMA>
<OMA>
<OMS cd="combinat1" name="binomial"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMA>
<OMS cd="arith1" name="times"/>
<OMI> 2 </OMI>
<OMV name="n"/>
</OMA>
<OMV name="m"/>
</OMA>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
<OMV name="k"/>
</OMA>
</OMA>
<OMA>
<OMS cd="combinat1" name="Stirling2"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
</OMA>
</OMBIND>
</OMA>
</OMA>
</OMOBJ>
eq
(
Stirling1
(
n ,
m )
,
sum
(
integer_interval
(
zero ,
minus
(
n ,
m )
)
,
lambda
[
k
] .
(
times
(
power
(
unary_minus
(
one )
,
k )
,
binomial
(
plus
(
minus
(
n ,
one )
,
k )
,
plus
(
minus
(
n ,
m )
,
k )
)
,
binomial
(
minus
(
times
( 2 ,
n )
,
m )
,
minus
(
minus
(
n ,
m )
,
k )
)
,
Stirling2
(
n ,
m )
)
)
)
)
Stirling1
(
n
,
m
)
=
∑
k
=
0
n
-
m
-
1
k
n
-
1
+
k
n
-
m
+
k
2
n
-
m
n
-
m
-
k
Stirling2
(
n
,
m
)
Example:
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Stirling1"/>
<OMI> 10 </OMI>
<OMI> 7 </OMI>
</OMA>
<OMI> -9450 </OMI>
</OMA>
</OMOBJ>
Stirling1
(
10
,
7
)
=
-9450
Signatures:
sts
Role:
application
Description:
The Stirling numbers of the second kind. Stirling2(n, m) is the number of
partitions of a set with n elements into m non empty subsets.
Note that there are a few slightly different definitions of these numbers.
Commented Mathematical property (CMP):
Stirling2(n,m) = 1/m! * the sum from k=0 to m of (-1)^(m-k) *
binomial(m,k) * k^n
Formal Mathematical property (FMP):
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Stirling2"/>
<OMV name="n"/>
<OMV name="m"/>
</OMA>
<OMA>
<OMS cd="arith1" name="times"/>
<OMA>
<OMS cd="arith1" name="divide"/>
<OMS cd="alg1" name="one"/>
<OMA>
<OMS cd="integer1" name="factorial"/>
<OMV name="m"/>
</OMA>
</OMA>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMS cd="alg1" name="zero"/>
<OMV name="m"/>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="k"/>
</OMBVAR>
<OMA>
<OMS cd="arith1" name="times"/>
<OMA>
<OMS cd="arith1" name="power"/>
<OMA>
<OMS cd="arith1" name="unary_minus"/>
<OMS cd="alg1" name="one"/>
</OMA>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="m"/>
<OMV name="k"/>
</OMA>
</OMA>
<OMA>
<OMS cd="combinat1" name="binomial"/>
<OMV name="m"/>
<OMV name="k"/>
</OMA>
<OMA>
<OMS cd="arith1" name="power"/>
<OMV name="k"/>
<OMV name="n"/>
</OMA>
</OMA>
</OMBIND>
</OMA>
</OMA>
</OMA>
</OMOBJ>
eq
(
Stirling2
(
n ,
m )
,
times
(
divide
(
one ,
factorial
(
m )
)
,
sum
(
integer_interval
(
zero ,
m )
,
lambda
[
k
] .
(
times
(
power
(
unary_minus
(
one )
,
minus
(
m ,
k )
)
,
binomial
(
m ,
k )
,
power
(
k ,
n )
)
)
)
)
)
Stirling2
(
n
,
m
)
=
1
m
!
∑
k
=
0
m
-
1
(
m
-
k
)
m
k
k
n
Example:
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Stirling2"/>
<OMI> 7 </OMI>
<OMI> 3 </OMI>
</OMA>
<OMI> 301 </OMI>
</OMA>
</OMOBJ>
Stirling2
(
7
,
3
)
=
301
Signatures:
sts
Role:
application
Description:
The Fibonacci numbers, defined by the linear recurrence:
Fibonacci(0) = 0, Fibonacci(1) = 1, and
Fibonacci(n + 1) = Fibonacci(n) + Fibonacci(n - 1).
Note that some authors define Fibonacci(0) = 1.
Commented Mathematical property (CMP):
Fibonacci(0) = 0, Fibonacci(1) = 1, and
Fibonacci(n + 1) = Fibonacci(n) + Fibonacci(n - 1)
Formal Mathematical property (FMP):
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="logic1" name="and"/>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Fibonacci"/>
<OMS cd="alg1" name="zero"/>
</OMA>
<OMS cd="alg1" name="zero"/>
</OMA>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Fibonacci"/>
<OMS cd="alg1" name="one"/>
</OMA>
<OMS cd="alg1" name="one"/>
</OMA>
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Fibonacci"/>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMV name="n"/>
<OMS cd="alg1" name="one"/>
</OMA>
</OMA>
<OMA>
<OMS cd="arith1" name="plus"/>
<OMA>
<OMS cd="combinat1" name="Fibonacci"/>
<OMV name="n"/>
</OMA>
<OMA>
<OMS cd="combinat1" name="Fibonacci"/>
<OMA>
<OMS cd="arith1" name="minus"/>
<OMV name="n"/>
<OMS cd="alg1" name="one"/>
</OMA>
</OMA>
</OMA>
</OMA>
</OMA>
</OMOBJ>
Fibonacci
(
0
)
=
0
∧
Fibonacci
(
1
)
=
1
∧
Fibonacci
(
n
+
1
)
=
Fibonacci
(
n
)
+
Fibonacci
(
n
-
1
)
Example:
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Fibonacci"/>
<OMI> 10 </OMI>
</OMA>
<OMI> 55 </OMI>
</OMA>
</OMOBJ>
Fibonacci
(
10
)
=
55
Signatures:
sts
Role:
application
Description:
The Bell numbers: Bell(n) is the total number of possible partitions of a set
of n elements.
Commented Mathematical property (CMP):
Bell(n) = the sum from k=0 to n of Stirling2(n,k)
Formal Mathematical property (FMP):
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Bell"/>
<OMV name="n"/>
</OMA>
<OMA>
<OMS cd="arith1" name="sum"/>
<OMA>
<OMS cd="interval1" name="integer_interval"/>
<OMS cd="alg1" name="zero"/>
<OMV name="n"/>
</OMA>
<OMBIND>
<OMS cd="fns1" name="lambda"/>
<OMBVAR>
<OMV name="k"/>
</OMBVAR>
<OMA>
<OMS cd="combinat1" name="Stirling2"/>
<OMV name="n"/>
<OMV name="k"/>
</OMA>
</OMBIND>
</OMA>
</OMA>
</OMOBJ>
Bell
(
n
)
=
∑
k
=
0
n
Stirling2
(
n
,
k
)
Example:
xml prefix mathml
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0" cdbase="http://www.openmath.org/cd">
<OMA>
<OMS cd="relation1" name="eq"/>
<OMA>
<OMS cd="combinat1" name="Bell"/>
<OMI> 7 </OMI>
</OMA>
<OMI> 877 </OMI>
</OMA>
</OMOBJ>
Bell
(
7
)
=
877
Signatures:
sts