Python | Numpy np.chebvander2d() method

With the help of np.chebvander2d() method, we can get the Pseudo-Vandermonde 2D matrix from given array having degree which is passed as parameter by using np.chebvander2d() method.

Syntax : np.chebvander2d(x, y, degree)
Return : Return the 2D matrix having size i.e array.size + (degree + 1).

Example #1 :
In this example we can see that by using np.chebvander2d() method, we are able to get the pseudo-vandermonde 2D matrix using this method.



filter_none

edit
close

play_arrow

link
brightness_4
code

# import numpy
import numpy as np
import numpy.polynomial.chebyshev as cheb
  
# using np.chebvander2d() method
gfg = cheb.chebvander2d((2, 4, 8, 1), (2, 4, 8, 1), 2)
  
print(gfg)

chevron_right


Output :

[[ 1. 2. 7.]
[ 1. 4. 31.]
[ 1. 8. 127.]
[ 1. 1. 1.]]

Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# import numpy
import numpy as np
import numpy.polynomial.chebyshev as cheb
  
# using np.chebvander2d() method
gfg = cheb.chebvander2d((3, 5, 1, 10), (3, 5, 1, 10), 4)
  
print(gfg)

chevron_right


Output :

[[1.0000e+00 3.0000e+00 1.7000e+01 9.9000e+01 5.7700e+02]
[1.0000e+00 5.0000e+00 4.9000e+01 4.8500e+02 4.8010e+03]
[1.0000e+00 1.0000e+00 1.0000e+00 1.0000e+00 1.0000e+00]
[1.0000e+00 1.0000e+01 1.9900e+02 3.9700e+03 7.9201e+04]]



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.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.