Python | Numpy np.hermevander2d () method

NumPy | Python Methods and Functions

With the method np.hermevander2d() , we can get the pseudo-Vandermonde matrix for 2D data that has degrees x and y using np. hermevander2d () .

Syntax: np.hermevander2d (x, y, [x_deg, y_deg])
Return: Return the pseudo vandermonde matrix of given 2-D data.

Example # 1:
B In this example, we can see that with np.hermevander2d () we can get a pseudo-vander data matrix of two-dimensional data having degree (x, y) using this method.

# import numpy and hermevander2d

import numpy as np

from numpy.polynomial.hermite_e import hermevander2d

 

x = np.array ([ 0.1 , 0.2 ])

y = np.array ([ 2 , 0.2 ])

x_deg, y_deg = 2 , 3

# using the np.hermevander2d () method

gfg = hermevander2d (x, y, [x_deg , y_deg])

 

print (gfg)

Output:

[[1. 2. 3. 2. 0.1 0.2 0.3 0.2
-0.99 -1.98 -2.97 -1.98]
[1. 0.2 -0.96 -0.592 0.2 0.04 -0.192 -0.1184
-0.96 -0.192 0.9216 0.56832]]

Example No. 2 :

# import numpy and hermevander2d

import numpy as np

from numpy.polynomial.hermite_e import hermevander2d

 

x = np.array ([ 1.01 , 2.02 < / code> , 3.03 ])

y = np.array ([ 10.1 , 20.2 , 30.3 ])

x_deg, y_deg = 1 , 1

# using the np.hermevander2d () method

gfg = hermevander2d (x, y, [x_deg, y_deg])

 

print (gfg)

Output:

[[1. 10.1 1.01 10.201]
[ one. 20.2 2.02 40.804]
[1. 30.3 3.03 91.809]]





Get Solution for free from DataCamp guru