Find real roots of the piecewise polynomial.
Parameters: | discontinuity : bool, optional
extrapolate : bool, optional
|
---|---|
Returns: | roots : ndarray
|
Notes
This routine works only on real-valued polynomials.
If the piecewise polynomial contains sections that are identically zero, the root list will contain the start point of the corresponding interval, followed by a nan value.
If the polynomial is discontinuous across a breakpoint, and there is a sign change across the breakpoint, this is reported if the discont parameter is True.
Examples
Finding roots of [x**2 - 1, (x - 1)**2] defined on intervals [-2, 1], [1, 2]:
>>> from scipy.interpolate import PPoly
>>> pp = PPoly(np.array([[1, 0, -1], [1, 0, 0]]).T, [-2, 1, 2])
>>> pp.roots()
array([-1., 1.])