FLINT fmpz_poly class wrapper¶
AUTHORS:
Robert Bradshaw (2007-09-15) Initial version.
William Stein (2007-10-02) update for new flint; add arithmetic and creation of coefficients of arbitrary size.
-
class
sage.libs.flint.fmpz_poly.
Fmpz_poly
¶ Bases:
sage.structure.sage_object.SageObject
Construct a new fmpz_poly from a sequence, constant coefficient, or string (in the same format as it prints).
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: Fmpz_poly([1,2,3]) 3 1 2 3 sage: Fmpz_poly(5) 1 5 sage: Fmpz_poly(str(Fmpz_poly([3,5,7]))) 3 3 5 7
-
degree
()¶ The degree of self.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,2,3]); f 3 1 2 3 sage: f.degree() 2 sage: Fmpz_poly(range(1000)).degree() 999 sage: Fmpz_poly([2,0]).degree() 0
-
derivative
()¶ Return the derivative of self.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,2,6]) sage: f.derivative().list() == [2, 12] True
-
div_rem
(other)¶ Return self / other, self, % other.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,3,4,5]) sage: g = f^23 sage: g.div_rem(f)[1] 0 sage: g.div_rem(f)[0] - f^22 0 sage: f = Fmpz_poly([1..10]) sage: g = Fmpz_poly([1,3,5]) sage: q, r = f.div_rem(g) sage: q*f+r 17 1 2 3 4 4 4 10 11 17 18 22 26 30 23 26 18 20 sage: g 3 1 3 5 sage: q*g+r 10 1 2 3 4 5 6 7 8 9 10
-
left_shift
(n)¶ Left shift self by n.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,2]) sage: f.left_shift(1).list() == [0,1,2] True
-
list
()¶ Return self as a list of coefficients, lowest terms first.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([2,1,0,-1]) sage: f.list() [2, 1, 0, -1]
-
pow_truncate
(exp, n)¶ Return self raised to the power of exp mod x^n.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,2]) sage: f.pow_truncate(10,3) 3 1 20 180 sage: f.pow_truncate(1000,3) 3 1 2000 1998000
-
pseudo_div
(other)¶
-
pseudo_div_rem
(other)¶
-
right_shift
(n)¶ Right shift self by n.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,2]) sage: f.right_shift(1).list() == [2] True
-
truncate
(n)¶ Return the truncation of self at degree n.
EXAMPLES:
sage: from sage.libs.flint.fmpz_poly import Fmpz_poly sage: f = Fmpz_poly([1,1]) sage: g = f**10; g 11 1 10 45 120 210 252 210 120 45 10 1 sage: g.truncate(5) 5 1 10 45 120 210
-