bundles / scipy 1.18.0 / scipy / linalg / _special_matrices / invpascal
function
scipy.linalg._special_matrices:invpascal
Signature
def invpascal(n, kind = symmetric, exact = True)Summary
Returns the inverse of 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 typenumpy.int64(ifn<= 35) or an object array of Python 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 for largen, the values in the array will not be the exact coefficients.
Returns
invp: (n, n) ndarrayThe inverse of the Pascal matrix.
Notes
Examples
from scipy.linalg import invpascal, pascal invp = invpascal(5) invp✓
array([[ 5, -10, 10, -5, 1],
[-10, 30, -35, 19, -4],
[ 10, -35, 46, -27, 6],
[ -5, 19, -27, 17, -4],
[ 1, -4, 6, -4, 1]])
p = pascal(5)
✓p.dot(invp)
✗array([[1., 0., 0., 0., 0.],
[0., 1., 0., 0., 0.],
[0., 0., 1., 0., 0.],
[0., 0., 0., 1., 0.],
[0., 0., 0., 0., 1.]])
An example of the use of `kind` and `exact`:
invpascal(5, kind='lower', exact=False)
✓array([[ 1., -0., 0., -0., 0.],
[-1., 1., -0., 0., -0.],
[ 1., -2., 1., -0., 0.],
[-1., 3., -3., 1., -0.],
[ 1., -4., 6., -4., 1.]])
See also
Aliases
scipy.linalg.invpascal