Python | Numpy np.cheb2poly () method

NumPy | Python Methods and Functions

Using the np.cheb2poly() method, we can get a polynomial from the Chebyshev series using np.cheb2poly () .

Syntax: np.cheb2poly (array)
Return: Return array having coefficients of polynomial.

Example # 1:
In this example we see that using np.cheb2poly () we can get polynomial from the Chebyshev series using this method.

# NumPy import

import numpy as np

from numpy import polynomial as P

 

x = np.array ([ 2 , 5 , 7 ])

 
# using the np.cheb2poly () method

gfg = P.Chebyshev (x)

gfg = gfg.convert (kind = P.Polynomial)

gfg = P.chebyshev.cheb2poly (gfg)

 

print (gfg)

[Polynomial ([- 5., 5., 14.], domain = [- 1., 1.], window = [- 1., 1.])]

< / blockquote>

Example # 2:

# NumPy import

import numpy as np

from numpy import polynomial as P

  

x = np .array ([ 2 , 3 , 5 , 7 , 11 ])

 
# using the np.cheb2poly () method

gfg = P.Chebyshev (x)

gfg = gfg.convert (kind = P.Polynomial)

gfg = P.chebyshev.cheb2poly (gfg)

 

print (gfg)

[Polynomial ([8., -18., -78., 28., 88.], domain = [- 1., 1.], window = [- 1., 1.])]





Get Solution for free from DataCamp guru