bundles / scipy latest / scipy / linalg / _special_matrices / pascal
function
scipy.linalg._special_matrices:pascal
Signature
def pascal ( n , kind = symmetric , exact = True ) Summary
Returns the n x n Pascal matrix.
Extended Summary
The Pascal matrix is a matrix containing the binomial coefficients as its elements.
Parameters
n: intThe size of the matrix to create; that is, the result is an n x n matrix.
kind: str, optionalMust be one of 'symmetric', 'lower', or 'upper'. Default is 'symmetric'.
exact: bool, optionalIf
exactis True, the result is either an array of type numpy.uint64 (if n < 35) or an object array of Python long integers. Ifexactis False, the coefficients in the matrix are computed using scipy.special.comb withexact=False. The result will be a floating point array, and the values in the array will not be the exact coefficients, but this version is much faster thanexact=True.
Returns
p: (n, n) ndarrayThe Pascal matrix.
Notes
See https://en.wikipedia.org/wiki/Pascal_matrix for more information about Pascal matrices.
Examples
from scipy.linalg import pascal pascal(4) pascal(4, kind='lower') pascal(50)[-1, -1] from scipy.special import comb comb(98, 49, exact=True)✓
See also
Aliases
-
scipy.linalg.pascal