Tuesday, October 7, 2025
HomeLanguagesPython | Numpy np.chebfit() method

Python | Numpy np.chebfit() method

With the help of np.chebfit() method, we can get the least square fit of chebyshev series by using np.chebfit() method.

Syntax : np.chebfit(x, y, degree)
Return : Return the array of chebyshev series coefficient values.

Example #1 :
In this example we can see that using np.chebfit() method, we are able to get the least square fit of chebyshev series using this method.




# import numpy
import numpy as np
import numpy.polynomial.chebyshev as cheb
  
# using np.chebfit() method
gfg = cheb.chebfit((4, -5), (5, 7), 1)
  
print(gfg)


Output :

[5.88888889, -0.22222222]

Example #2 :




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


Output :

[1.39458146e+00 1.41166773e-01 1.53673202e-03 -2.82264138e-05]

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32340 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6829 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6784 POSTS0 COMMENTS