Python | The numpy np.chebval () method



Using the np.chebval() method, we can get an array of coefficients after calculating x on Chebyshev series using np.chebval () .

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

Example # 1:
In this example we can see that with np.chebval () we can get an array of coefficients by calculating x along the Chebyshev row.

# NumPy import

import numpy as np

import numpy.polynomial.chebyshev as cheb

 
# using the method np.chebval ()

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

 

print (gfg)

Output:

[1. 31.]

Example # 2:

# NumPy import

import numpy as np

import numpy.polynomial.chebyshev as cheb

 
# using the np.chebval () method

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

 

print (gfg )

Output:

 [5.0000e + 00 1.0790e + 03 7.2570e + 03 2.5643e + 04]