Univariate polynomials over number fields.¶
AUTHOR:
- Luis Felipe Tabera Alonso (2014-02): initial version.
EXAMPLES:
Define a polynomial over an absolute number field and perform basic operations with them:
sage: N.<a> = NumberField(x^2-2)
sage: K.<x> = N[]
sage: f = x - a
sage: g = x^3 - 2*a + 1
sage: f*(x + a)
x^2 - 2
sage: f + g
x^3 + x - 3*a + 1
sage: g // f
x^2 + a*x + 2
sage: g % f
1
sage: factor(x^3 - 2*a*x^2 - 2*x + 4*a)
(x - 2*a) * (x - a) * (x + a)
sage: gcd(f, x - a)
x - a
Polynomials are aware of embeddings of the underlying field:
sage: x = var('x')
sage: Q7 = Qp(7)
sage: r1 = Q7(3 + 7 + 2*7^2 + 6*7^3 + 7^4 + 2*7^5 + 7^6 + 2*7^7 + 4*7^8 +\
6*7^9 + 6*7^10 + 2*7^11 + 7^12 + 7^13 + 2*7^15 + 7^16 + 7^17 +\
4*7^18 + 6*7^19)
sage: N.<b> = NumberField(x^2-2, embedding = r1)
sage: K.<t> = N[]
sage: f = t^3-2*t+1
sage: f(r1)
1 + O(7^20)
We can also construct polynomials over relative number fields:
sage: N.<i, s2> = QQ[I, sqrt(2)]
sage: K.<x> = N[]
sage: f = x - s2
sage: g = x^3 - 2*i*x^2 + s2*x
sage: f*(x + s2)
x^2 - 2
sage: f + g
x^3 - 2*I*x^2 + (sqrt2 + 1)*x - sqrt2
sage: g // f
x^2 + (-2*I + sqrt2)*x - 2*sqrt2*I + sqrt2 + 2
sage: g % f
-4*I + 2*sqrt2 + 2
sage: factor(i*x^4 - 2*i*x^2 + 9*i)
(I) * (x - I + sqrt2) * (x + I - sqrt2) * (x - I - sqrt2) * (x + I + sqrt2)
sage: gcd(f, x-i)
1
-
class
sage.rings.polynomial.polynomial_number_field.
Polynomial_absolute_number_field_dense
(parent, x=None, check=True, is_gen=False, construct=False)¶ Bases:
sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_dense_field
Class of dense univariate polynomials over an absolute number field.
-
gcd
(other)¶ Compute the monic gcd of two univariate polynomials using PARI.
INPUT:
other
– a polynomial with the same parent asself
.
OUTPUT:
- The monic gcd of
self
andother
.
EXAMPLES:
sage: N.<a> = NumberField(x^3-1/2, 'a') sage: R.<r> = N['r'] sage: f = (5/4*a^2 - 2*a + 4)*r^2 + (5*a^2 - 81/5*a - 17/2)*r + 4/5*a^2 + 24*a + 6 sage: g = (5/4*a^2 - 2*a + 4)*r^2 + (-11*a^2 + 79/5*a - 7/2)*r - 4/5*a^2 - 24*a - 6 sage: gcd(f, g**2) r - 60808/96625*a^2 - 69936/96625*a - 149212/96625 sage: R = QQ[I]['x'] sage: f = R.random_element(2) sage: g = f + 1 sage: h = R.random_element(2).monic() sage: f *=h sage: g *=h sage: gcd(f, g) - h 0 sage: f.gcd(g) - h 0
-
-
class
sage.rings.polynomial.polynomial_number_field.
Polynomial_relative_number_field_dense
(parent, x=None, check=True, is_gen=False, construct=False)¶ Bases:
sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_dense_field
Class of dense univariate polynomials over a relative number field.
-
gcd
(other)¶ Compute the monic gcd of two polynomials.
Currently, the method checks corner cases in which one of the polynomials is zero or a constant. Then, computes an absolute extension and performs the computations there.
INPUT:
other
– a polynomial with the same parent asself
.
OUTPUT:
- The monic gcd of
self
andother
.
See
Polynomial_absolute_number_field_dense.gcd()
for more details.EXAMPLES:
sage: N = QQ[sqrt(2), sqrt(3)] sage: s2, s3 = N.gens() sage: x = polygen(N) sage: f = x^4 - 5*x^2 +6 sage: g = x^3 + (-2*s2 + s3)*x^2 + (-2*s3*s2 + 2)*x + 2*s3 sage: gcd(f, g) x^2 + (-sqrt2 + sqrt3)*x - sqrt3*sqrt2 sage: f.gcd(g) x^2 + (-sqrt2 + sqrt3)*x - sqrt3*sqrt2
-