我想使用 Python 找到任意阶 Chebysev 多项式的根。我见过类似的勒让德多项式线程。但是,我使用此处定义的方法构造了多项式
import numpy as np
import sympy as sp
f0 = lambda x: chebyt(0,x)
f1 = lambda x: chebyt(1,x)
f2 = lambda x: chebyt(2,x)
f3 = lambda x: chebyt(3,x)
f4 = lambda x: chebyt(4,x)
plot([f0,f1,f2,f3,f4],[-1,1])
我尝试使用np.roots(f4)
,但收到以下错误:TypeError: float() argument must be a string or a number, not 'function'
。此外,似乎即使我可以,它也不适用于高阶多项式。