为什么numpy中有两套多项式工具?一个比另一个更可取,还是纯粹是意见?

Why are there two sets of polynomial tools in numpy? Is one preferable to the other, or is it purely opinion?

numpy 有两套多项式工具,一套在基础 numpy 库中,另一套在 numpy.polynomial 中。为什么有两个?一个比另一个更可取吗?这是为了保持向后兼容性,还是我应该注意的重大差异?

例如,polyfitpolyval 在两个库中都可以找到,并且似乎使用相同的算法,但它们的参数不同(它们期望系数的顺序相反)。

来自numpy

def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False)
def polyval(p, x)

系数从高到低度排序。

来自numpy.polynomial

def polyfit(x, y, deg, rcond=None, full=False, w=None)
def polyval(x, c, tensor=True) 

系数从低到高度排序。

我运行穿过这个在docs:

Prior to NumPy 1.4, numpy.poly1d was the class of choice and it is still available in order to maintain backward compatibility. However, the newer Polynomial package is more complete than numpy.poly1d and its convenience classes are better behaved in the numpy environment. Therefore numpy.polynomial is recommended for new coding.