With the help of np.hermevander()
method, we can get the pseudo vandermonde matrix at a given degree by using np.hermevander()
method.
Syntax :
np.hermevander(x, deg)
Return : Return the pseudo vandermonde matrix.
Example #1 :
In this example we can see that by using np.hermevander()
method, we are able to get the pseudo vandermonde matrix at a given degree by using this method.
# import numpy and hermevander import numpy as np from numpy.polynomial.hermite_e import hermevander x = np.array([ 0.1 , 0.2 , 0.3 , 0.4 , 0.5 ]) deg = 3 # using np.hermevander() method gfg = hermevander(x, deg) print (gfg) |
Output :
[[ 1. 0.1 -0.99 -0.299]
[ 1. 0.2 -0.96 -0.592]
[ 1. 0.3 -0.91 -0.873]
[ 1. 0.4 -0.84 -1.136]
[ 1. 0.5 -0.75 -1.375]]
Example #2 :
# import numpy and hermevander import numpy as np from numpy.polynomial.hermite_e import hermevander x = np.array([ 1.1 , 2.2 , 3.3 , 4.4 , 5.5 ]) deg = 3 # using np.hermevander() method gfg = hermevander(x, deg) print (gfg) |
Output :
[[ 1. 1.1 0.21 -1.969]
[ 1. 2.2 3.84 4.048]
[ 1. 3.3 9.89 26.037]
[ 1. 4.4 18.36 71.984]
[ 1. 5.5 29.25 149.875]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.