scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
invpascal(n, kind='symmetric', exact=True)

The Pascal matrix is a matrix containing the binomial coefficients as its elements.

Notes

versionadded

Parameters

n : int

The size of the matrix to create; that is, the result is an n x n matrix.

kind : str, optional

Must be one of 'symmetric', 'lower', or 'upper'. Default is 'symmetric'.

exact : bool, optional

If :None:None:`exact` is True, the result is either an array of type numpy.int64 (if n <= 35) or an object array of Python integers. If :None:None:`exact` is False, the coefficients in the matrix are computed using scipy.special.comb with :None:None:`exact=False`. The result will be a floating point array, and for large n, the values in the array will not be the exact coefficients.

Returns

invp : (n, n) ndarray

The inverse of the Pascal matrix.

Returns the inverse of the n x n Pascal matrix.

See Also

pascal

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 :None:None:`kind` and :None:None:`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 :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.linalg._special_matrices.invpascal scipy.linalg._special_matrices.pascal

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/_special_matrices.py#862
type: <class 'function'>
Commit: