The vander() function in Python is simply used to generate a Vandermonde matrix.
numpy.vander(x, N=None, increasing=False)
The vander() function takes the following parameter values.
x: This represents the 1-D input array.N: This represents the number of columns in the output matrix or array.increasing: This takes a Boolean value and represents the power of the columns. If True, the powers increase from left to right, if False by default, they are reversed.The vander() function returns a Vandermonde matrix.
import numpy as np# creating an arraymyarray = np.array([1, 2, 3, 4, 5])# implementing the vander() functionmymatrix = np.vander(myarray, N=3, increasing=False)print(mymatrix)
numpy module.myarray, having 5 elements.vander() function on the array myarray using 3, as the number of columns of the output array and a default value for the increasing parameter. The output is assigned to a new variable, mymatrix.mymatrix.