acb_poly – polynomials over complex numbers

class flint.acb_poly(val=None)
coeffs(self)
degree(self) → long
derivative(self)
evaluate(self, xs, algorithm='fast')

Multipoint evaluation: evaluates self at the list of points xs. The algorithm can be ‘iter’ or ‘fast’. The ‘fast’ algorithm is asymptotically fast, but has worse numerical stability.

Note: for ordinary single-point evaluation, just call the polynomial with the point as the argument.

from_roots(type cls, roots)

Constructs the monic polynomial whose roots are the given complex numbers.

>>> acb_poly.from_roots(range(4))
1.00000000000000*x^4 + (-6.00000000000000)*x^3 + 11.0000000000000*x^2 + (-6.00000000000000)*x
integral(self)
interpolate(type cls, xs, ys, algorithm='fast')

Constructs the unique interpolating polynomial of length at most n taking the values ys when evaluated at the n distinct points xs. Algorithm can be ‘newton’, ‘barycentric’ or ‘fast’. The ‘fast’ algorithm is asymptotically fast, but has worse numerical stability.

length(self) → long
repr(self)
root_bound(self)

Returns an upper bound for the absolute value of the roots of self.

roots(s, tol=None, maxprec=None)

Attempts to isolate all the complex roots of s. If tol is specified, the roots are further refined to at least the requested tolerance. The input polynomial must be squarefree and sufficiently accurate. Raises an exception if unsuccessful.

>>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(c)
...
[1.00000000000000 +/- 7.71e-18] + [+/- 7.59e-18]j
[2.00000000000000 +/- 1.18e-16] + [+/- 1.16e-16]j
[3.00000000000000 +/- 4.24e-16] + [+/- 4.22e-16]j
[4.00000000000000 +/- 7.21e-16] + [+/- 7.00e-16]j
[5.00000000000000 +/- 2.41e-16] + [+/- 2.24e-16]j
>>> for c in acb_poly.from_roots([1,2,2,4,5]).roots(1e-10): print(c)
...
Traceback (most recent call last):
  ...
ValueError: roots() failed to converge: insufficient precision, or squareful input
str(self, bool ascending=False)

Convert to a human-readable string (generic implementation for all polynomial types).

If ascending is True, the monomials are output from low degree to high, otherwise from high to low.

unique_fmpz_poly(self)