Method:
np.vander(x, N=None, increasing=False)
Generates a Vandermonde matrix from a vector.
Returns:
np.ndarray
Parameters:
x: array-like-
The input vector.
import numpy as np
result = np.vander(x=[4, 2, 3])
print(result)
'''
Output:
[[16 4 1]
[ 4 2 1]
[ 9 3 1]]
'''
N: int, Optional-
The number of columns in the output matrix (default is len(x)).
import numpy as np
result = np.vander(x=[4, 2, 3], N=4)
print(result)
'''
Output:
[[64 16 4 1]
[ 8 4 2 1]
[27 9 3 1]]
'''
increasing: (True or False), Optional-
If True, the powers of x are in increasing order (default False).
increasing = False (default) +
The diagonal offset is 0,0.
import numpy as np
result = np.vander(x=[4, 2, 3], N=4, increasing=False)
print(result)
'''
Output:
[[64 16 4 1]
[ 8 4 2 1]
[27 9 3 1]]
'''
increasing = True +
The diagonal offset is 0,1.
import numpy as np
result = np.vander(x=[4, 2, 3], N=4, increasing=True)
print(result)
'''
Output:
[[ 1 4 16 64]
[ 1 2 4 8]
[ 1 3 9 27]]
'''