Python | Numpy np.chebfromroots () method

NumPy | Python Methods and Functions

Using the np.chebfromroots() method, we can get a Chebyshev row with roots passed as a parameter to np.chebfromroots () .

Syntax: np.chebfromroots (roots)
Return: Return the chebyshev series .

Example # 1:
In this example, we see that with np.chebfromroots () we can get Chebyshev rows generated by the roots that are passed by the parameter.

# NumPy imports

import numpy as np

import numpy .polynomial.chebyshev as cheb

 
# using the np.chebfromroots () method

gfg = cheb.chebfromroots (( 2 , 4 , 8 , 1 ))

 

print (gfg)

Exit:

[9.9375e + 01 -1.3125e + 02 3.5500e + 01 -3.7500e + 00 1.2500e-01]

Example # 2:

# NumPy imports

import numpy as np

import numpy. polynomial.chebyshev as cheb 

 
# using the np.chebfromroots () method

gfg = cheb.chebfromroots (( - 3 , 4 , - 5 , 1 , 10 ) )

 

print (gfg)

Output:

[-5.19125e + 02 4.52375e + 02 8.00000e + 01 -1.24375e + 01 -8.75000e-01 6.25000e-02]





Get Solution for free from DataCamp guru