MCPcopy Index your code
hub / github.com/numpy/numpy / interpolate

Method interpolate

numpy/polynomial/chebyshev.py:2011–2048  ·  view source on GitHub ↗

Interpolate a function at the Chebyshev points of the first kind. Returns the series that interpolates `func` at the Chebyshev points of the first kind scaled and shifted to the `domain`. The resulting series tends to a minmax approximation of `func` when the function is

(cls, func, deg, domain=None, args=())

Source from the content-addressed store, hash-verified

2009
2010 @classmethod
2011 def interpolate(cls, func, deg, domain=None, args=()):
2012 """Interpolate a function at the Chebyshev points of the first kind.
2013
2014 Returns the series that interpolates `func` at the Chebyshev points of
2015 the first kind scaled and shifted to the `domain`. The resulting series
2016 tends to a minmax approximation of `func` when the function is
2017 continuous in the domain.
2018
2019 Parameters
2020 ----------
2021 func : function
2022 The function to be interpolated. It must be a function of a single
2023 variable of the form ``f(x, a, b, c...)``, where ``a, b, c...`` are
2024 extra arguments passed in the `args` parameter.
2025 deg : int
2026 Degree of the interpolating polynomial.
2027 domain : {None, [beg, end]}, optional
2028 Domain over which `func` is interpolated. The default is None, in
2029 which case the domain is [-1, 1].
2030 args : tuple, optional
2031 Extra arguments to be used in the function call. Default is no
2032 extra arguments.
2033
2034 Returns
2035 -------
2036 polynomial : Chebyshev instance
2037 Interpolating Chebyshev instance.
2038
2039 Notes
2040 -----
2041 See `numpy.polynomial.chebinterpolate` for more details.
2042
2043 """
2044 if domain is None:
2045 domain = cls.domain
2046 xfunc = lambda x: func(pu.mapdomain(x, cls.window, domain), *args)
2047 coef = chebinterpolate(xfunc, deg)
2048 return cls(coef, domain=domain)
2049
2050 # Virtual properties
2051 domain = np.array(chebdomain)

Callers 2

test_dimensionsMethod · 0.80
test_approximationMethod · 0.80

Calls 2

chebinterpolateFunction · 0.85
funcFunction · 0.50

Tested by 2

test_dimensionsMethod · 0.64
test_approximationMethod · 0.64