Python | Numpy np.chebgrid2d () method

NumPy | Python Methods and Functions

Using the np.chebgrid2d () method, we can get an array of coefficients after calculating the Chebyshev series from the Cartesian product of x and y using np.chebgrid2d () .

Syntax: np.chebgrid2d (x, y, c)
Return: Return an array after evaluation on (x, y).

Example # 1:
In this example, we can see that using np.chebgrid2d () , we can get an array of coefficients by evaluating Chebyshev series on the Cartesian product of x and y.

# NumPy import

import numpy as np

import numpy.polynomial.chebyshev as cheb

 
  # using the np.chebgrid2d () method

gfg = cheb.chebgrid2d (( 2 , 5 ), ( 1 , 3 ), ( 2 , - 4 , 1 ))

 

print (gfg)

Output:

[32. 94.]

Example # 2:

# NumPy import

import numpy as np

import numpy.polynomial.chebyshev as cheb

 
# using the np.chebgrid2d () method

gfg = cheb.chebgrid2d (( 1 , 3 , 5 , 7 ), ( 2 , 4 , 8 ), ( 2 , - 4 , 1 , 5 , 1 ))

  

print (gfg)

Output:

[719680. 6486180.52831708.]





Get Solution for free from DataCamp guru