Documentation Center

  • Trial Software
  • Product Updates

combinat::catalan

Catalan numbers

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

combinat::catalan(n)

Description

combinat::catalan(n) returns the n-th Catalan number.

The Catalan numbers are ubiquitous in combinatorics. For example, combinat::catalan(n) counts the Dyck words of size n, the ordered trees with n nodes, the binary trees with n+1 nodes, the complete binary trees with 2n+1 nodes, the standard tableaux with two rows of size n, the triangulations of a regular n+2-gone, or the non-crossing partitions of {1, 2, …, n}.

combinat::catalan(n) is calculated using the formula

.

Examples

Example 1

We compute the first Catalan numbers:

combinat::catalan(n) $ n = 0..6

Example 2

If one uses a wrong argument, an error message is returned

combinat::catalan(-1)
Error: The type of argument number 1 must be 'Type::NonNegInt'. The object '-1' is incorrect.
  Evaluating: combinat::catalan

Parameters

n

Nonnegative integer

Return Values

Positive integer.

Was this topic helpful?