numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns
vander(x, N=None, increasing=False)

The columns of the output matrix are powers of the input vector. The order of the powers is determined by the :None:None:`increasing` boolean argument. Specifically, when :None:None:`increasing` is False, the i-th output column is the input vector raised element-wise to the power of N - i - 1 . Such a matrix with a geometric progression in each row is named for Alexandre- Theophile Vandermonde.

Parameters

x : array_like

1-D input array.

N : int, optional

Number of columns in the output. If N is not specified, a square array is returned ( N = len(x) ).

increasing : bool, optional

Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.

versionadded

Returns

out : ndarray

Vandermonde matrix. If :None:None:`increasing` is False, the first column is x^(N-1) , the second x^(N-2) and so forth. If :None:None:`increasing` is True, the columns are x^0, x^1, ..., x^(N-1) .

Generate a Vandermonde matrix.

See Also

polynomial.polynomial.polyvander

Examples

>>> x = np.array([1, 2, 3, 5])
... N = 3
... np.vander(x, N) array([[ 1, 1, 1], [ 4, 2, 1], [ 9, 3, 1], [25, 5, 1]])
>>> np.column_stack([x**(N-1-i) for i in range(N)])
array([[ 1,  1,  1],
       [ 4,  2,  1],
       [ 9,  3,  1],
       [25,  5,  1]])
>>> x = np.array([1, 2, 3, 5])
... np.vander(x) array([[ 1, 1, 1, 1], [ 8, 4, 2, 1], [ 27, 9, 3, 1], [125, 25, 5, 1]])
>>> np.vander(x, increasing=True)
array([[  1,   1,   1,   1],
       [  1,   2,   4,   8],
       [  1,   3,   9,  27],
       [  1,   5,  25, 125]])

The determinant of a square Vandermonde matrix is the product of the differences between the values of the input vector:

>>> np.linalg.det(np.vander(x))
48.000000000000043 # may vary
>>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1)
48
See :

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 : /numpy/lib/twodim_base.py#540
type: <class 'function'>
Commit: