use 'np.polynomial.chebyshev.chebroots' instead of 'np.roots'
This commit is contained in:
committed by
GitHub
parent
1b26f2b725
commit
1bc9d5c8c6
@@ -1,6 +1,7 @@
|
||||
from mpmath import chebyt, chop, taylor
|
||||
import numpy as np
|
||||
def chebyshev_roots(n):
|
||||
""" Return the roots of *n* Chebyshev polynomials (between [-1, 1]) """
|
||||
return np.roots(chop(taylor(lambda x: chebyt(n, x), 0, n))[::-1])
|
||||
coefficents = np.zeros(n+1)
|
||||
coefficents[-1] = 1
|
||||
return np.polynomial.chebyshev.chebroots(coefficents)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user