bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / polynomial / chebyshev / chebinterpolate
function
numpy.polynomial.chebyshev:chebinterpolate
source: build-install/usr/lib/python3.14/site-packages/numpy/polynomial/chebyshev.py :1727
Signature
def chebinterpolate ( func , deg , args = () ) Summary
Interpolate a function at the Chebyshev points of the first kind.
Extended Summary
Returns the Chebyshev series that interpolates func at the Chebyshev points of the first kind in the interval [-1, 1]. The interpolating series tends to a minmax approximation to func with increasing deg if the function is continuous in the interval.
Parameters
func: functionThe function to be approximated. It must be a function of a single variable of the form
f(x, a, b, c...), wherea, b, c...are extra arguments passed in theargsparameter.deg: intDegree of the interpolating polynomial
args: tuple, optionalExtra arguments to be used in the function call. Default is no extra arguments.
Returns
coef: ndarray, shape (deg + 1,)Chebyshev coefficients of the interpolating series ordered from low to high.
Notes
The Chebyshev polynomials used in the interpolation are orthogonal when sampled at the Chebyshev points of the first kind. If it is desired to constrain some of the coefficients they can simply be set to the desired value after the interpolation, no new interpolation or fit is needed. This is especially useful if it is known apriori that some of coefficients are zero. For instance, if the function is even then the coefficients of the terms of odd degree in the result can be set to zero.
Examples
import numpy.polynomial.chebyshev as C
✓C.chebinterpolate(lambda x: np.tanh(x) + 0.5, 8)
✗Aliases
-
numpy.polynomial.chebyshev.chebinterpolate