MCPcopy Create free account
hub / github.com/numpy/numpy / chebpts1

Function chebpts1

numpy/polynomial/chebyshev.py:1920–1954  ·  view source on GitHub ↗

Chebyshev points of the first kind. The Chebyshev points of the first kind are the points ``cos(x)``, where ``x = [pi*(k + .5)/npts for k in range(npts)]``. Parameters ---------- npts : int Number of sample points desired. Returns ------- pts : ndarray

(npts)

Source from the content-addressed store, hash-verified

1918
1919
1920def chebpts1(npts):
1921 """
1922 Chebyshev points of the first kind.
1923
1924 The Chebyshev points of the first kind are the points ``cos(x)``,
1925 where ``x = [pi*(k + .5)/npts for k in range(npts)]``.
1926
1927 Parameters
1928 ----------
1929 npts : int
1930 Number of sample points desired.
1931
1932 Returns
1933 -------
1934 pts : ndarray
1935 The Chebyshev points of the first kind.
1936
1937 See Also
1938 --------
1939 chebpts2
1940
1941 Notes
1942 -----
1943
1944 .. versionadded:: 1.5.0
1945
1946 """
1947 _npts = int(npts)
1948 if _npts != npts:
1949 raise ValueError("npts must be integer")
1950 if _npts < 1:
1951 raise ValueError("npts must be >= 1")
1952
1953 x = 0.5 * np.pi / _npts * np.arange(-_npts+1, _npts+1, 2)
1954 return np.sin(x)
1955
1956
1957def chebpts2(npts):

Callers 1

chebinterpolateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected