% $Id: stirling2.tex,v 1.1.1.2 2004/10/04 17:25:16 nthiery Exp $
\begin{Mhelppage}{stirling2}{Torsten Metzner}
  [ImplState=stable,TestState=stable,DocState=stable]
\Mproofread{stefanw}{5.6.00}{fertig}
\Mproofread{nthiery}{10/2003}{proofread}

\begin{MInfo}
  \eng{Stirling numbers of the second kind}
  \de{}
\end{MInfo}

\begin{MIntro}
  \eng{\Mthis(n,k) computes the Stirling numbers of the second kind.}
  \de{\large !! Noch keine deutsche Doku vorhanden}
\end{MIntro}

\begin{MCalls}
  \Mcall{n,k}

\end{MCalls}

\begin{MParameters}
  \param{n,k}
    \eng{nonnegative integers}
    \de{}
\end{MParameters}

\begin{MReturnValue}
   \eng{a nonnegative integer.}
   \de{}
\end{MReturnValue}

\MKeywords{combinatorics}

\begin{MDetails}
  \eng{\Mthis(n,k) computes the number of ways of partitioning
    a set of \Mpar{n} elements into \Mpar{k} non-empty subsets.}
  \de{}

  \eng{\Mthis(n,k) is calculated using the formula
\Mdmath{stirling2(n,k) = 1/k! * sum((-1)\^{}(k-j)*binomial(k,j)*j\^{}n,j=0...k) .} 
{stirling2(n,k) = \frac{1}{k!} \sum_{j=0}^{k} (-1)^{k-j} {k\choose j}  j^n .}}
  \de{}
\end{MDetails}

\begin{MExample}{ex1}
\eng{One can partition the set \Mmath{{1,2,3}}{\{1,2,3\}} into 
\Mmath{{1,2,3} = {1,2} union {3} = {1,3} union {2} = {2,3} union {1}}
{\{1,2,3\} = \{1,2\} \cup \{3\} = \{1,3\} \cup \{2\} = \{2,3\} \cup \{1\}}}
\begin{Mexin}
combinat::stirling2(3,2)
\end{Mexin}
\begin{Mexout}
                               3
\end{Mexout}
\end{MExample}

\begin{MExample}{ex2}
\begin{Mexin}
combinat::stirling2(3)  
\end{Mexin}
\begin{Mexout}
Error: Two arguments expected. [combinat::stirling2]
\end{Mexout}
\end{MExample}

\begin{MChanges}
  \version{2.0} 
  \none
\end{MChanges}

\end{Mhelppage}
