With the help of np.hermvander2d()
method, we can get the 2-D pseudo vandermonde matrix from hermite series of given degree by using np.hermvander2d()
method.
Syntax :
np.hermvander2d(x, y, deg)
Return : Return the 2-D pseudo vandermonde matrix of given degree.
Example #1 :
In this example we can see that by using np.hermvander2d()
method, we are able to get the 2-D pseudo vandermonde matrix of hermite series by using this method.
# import numpy and hermvander2d import numpy as np from numpy.polynomial.hermite import hermvander2d x = np.array([ 1 , 2 ]) y = np.array([ - 1 , - 2 ]) x_deg, y_deg = 2 , 2 # using np.hermvander2d() method gfg = hermvander2d(x, y, [x_deg, y_deg]) print (gfg) |
Output :
[[ 1. -2. 2. 2. -4. 4. 2. -4. 4.]
[ 1. -4. 14. 4. -16. 56. 14. -56. 196.]]
Example #2 :
# import numpy and hermvander2d import numpy as np from numpy.polynomial.hermite import hermvander2d x = np.array([ 0.5 , 0.10 , 0.10 , 0.5 ]) y = np.array([ 1 , 2 , 3 , 5 ]) x_deg, y_deg = 1 , 1 # using np.hermvander2d() method gfg = hermvander2d(x, y, [x_deg, y_deg]) print (gfg) |
Output :
[[ 1. 2. 1. 2. ]
[ 1. 4. 0.2 0.8]
[ 1. 6. 0.2 1.2]
[ 1. 10. 1. 10. ]]