Python | Numpy np.hermvander2d() method

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

[[ 1. -2. 2. 2. -4. 4. 2. -4. 4.]
[ 1. -4. 14. 4. -16. 56. 14. -56. 196.]]



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output :

[[ 1. 2. 1. 2. ]
[ 1. 4. 0.2 0.8]
[ 1. 6. 0.2 1.2]
[ 1. 10. 1. 10. ]]

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.