Python | Numpy np.hermevander2d() method
Last Updated :
11 Dec, 2019
With the help of np.hermevander2d()
method, we can get the pseudo vandermonde matrix of a given 2-D data having degrees x and y by using np.hermevander2d()
method.
Syntax : np.hermevander2d(x, y, [x_deg, y_deg])
Return : Return the pseudo vandermonde matrix of given 2-D data.
Example #1 :
In this example we can see that by using np.hermevander2d()
method, we are able to get the pseudo vandermonde matrix of a given 2-D data having degree (x, y) by using this method.
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
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 #2 :
import numpy as np
from numpy.polynomial.hermite_e import hermevander2d
x = np.array([ 1.01 , 2.02 , 3.03 ])
y = np.array([ 10.1 , 20.2 , 30.3 ])
x_deg, y_deg = 1 , 1
gfg = hermevander2d(x, y, [x_deg, y_deg])
print (gfg)
|
Output :
[[ 1. 10.1 1.01 10.201]
[ 1. 20.2 2.02 40.804]
[ 1. 30.3 3.03 91.809]]
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...