From 1bc9d5c8c6b98a7269397a2c5ff9f2a1fed6733d Mon Sep 17 00:00:00 2001 From: Francesco Andreuzzi Date: Wed, 16 Feb 2022 23:48:59 +0100 Subject: [PATCH] use 'np.polynomial.chebyshev.chebroots' instead of 'np.roots' --- pina/chebyshev.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pina/chebyshev.py b/pina/chebyshev.py index 6a9fa15..89cb1e6 100644 --- a/pina/chebyshev.py +++ b/pina/chebyshev.py @@ -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)