type/partition - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/partition

type/partition

check for an integer partition

 Calling Sequence type( expr, 'partition' )

Parameters

 expr - anything; any Maple expression

Description

 • The call type( expr, 'partition' ) returns true if expr is a partition of a positive integer, and returns false otherwise.
 • A partition of a positive integer $n$ is a list [ ${k}_{1},\mathrm{...},{k}_{r}$]. of positive integers ${k}_{i}$, whose sum is equal to $n$, and which is non-decreasing, that is, which satisfies $\mathrm{add}\left({k}_{i},i=1..r\right)=n$ and ${k}_{i}\le {k}_{i+1}$, for $i$ in $1..r-1$.

Examples

 > $\mathrm{type}\left(\left\{\left\{1,2\right\},\left\{3,4\right\}\right\},'\mathrm{partition}'\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{type}\left(\left[1,2,\frac{2}{3}\right],'\mathrm{partition}'\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{type}\left(\left[1,-2,3\right],'\mathrm{partition}'\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{type}\left(\left[1,2,3\right],'\mathrm{partition}'\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{type}\left(\left[1,2,3,3,4\right],'\mathrm{partition}'\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{type}\left(\left[1,2,3,3,2\right],'\mathrm{partition}'\right)$
 ${\mathrm{false}}$ (6)