pascal
Pascal matrix — symmetric matrix of binomial coefficients.
Syntax
Section titled “Syntax”A = pascal(n)A = pascal(n, type)Description
Section titled “Description”Returns the n×n symmetric Pascal matrix whose entries are binomial coefficients: A(i, j) = C(i+j-2, i-1). The first row and column are all ones; each interior entry is the sum of the entry above and the entry to the left.
The type argument is reserved for future variants (lower-triangular, transposed); only type = 0 (default symmetric) is currently implemented.
Examples
Section titled “Examples”pascal(4) % [1 1 1 1; 1 2 3 4; 1 3 6 10; 1 4 10 20]sum(pascal(5)) % cumulative diagonal pattern