First page Back Continue Last page Overview Graphics

Polynoms

Working with Polynoms is supported.

Calculating the roots of a polynom with roots(), e.g.

f(x) = x3 – 2x2 -5x + 6:

>>> np.roots([ 1, -2, -5, 6])

array([-2., 3., 1.])

>>> np.roots([1,1,1])

array([-0.5+0.8660254j, -0.5-0.8660254j])

>>>

With poly() we can calculate the polynom from given roots:

>>> np.poly([-2., 3., 1.])

array([ 1., -2., -5., 6.])

>>>