numpy多项式

定义一个多项式: \(p = x^2 + 2x + 1\)

import numpy as np
p = np.poly1d([1, 2, 1])

运算,设有两个多项式: \(p_1 = (x^2 + 2x + 1), p_2 = (2x^2 - x +3 )\)

>>> p1 = np.poly1d([1, 2, 1])
>>> p2 = np.poly1d([2, -1, 3])
>>> p1+p2
poly1d([3, 1, 4])
>>> p1-p2
poly1d([-1 ...
more ...