Ideals of relative number fields

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a,b> = NumberField([x^2 + 1, x^2 + 2])
sage: A = K.absolute_field('z')
sage: I = A.factor(7)[0][0]
sage: from_A, to_A = A.structure()
sage: G = [from_A(z) for z in I.gens()]; G
[7, -2*b*a - 1]
sage: K.fractional_ideal(G)
Fractional ideal ((1/2*b + 2)*a - 1/2*b + 2)
sage: K.fractional_ideal(G).absolute_norm().factor()
7^2
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) + Integer(2)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> A = K.absolute_field('z')
>>> I = A.factor(Integer(7))[Integer(0)][Integer(0)]
>>> from_A, to_A = A.structure()
>>> G = [from_A(z) for z in I.gens()]; G
[7, -2*b*a - 1]
>>> K.fractional_ideal(G)
Fractional ideal ((1/2*b + 2)*a - 1/2*b + 2)
>>> K.fractional_ideal(G).absolute_norm().factor()
7^2
x = polygen(ZZ, 'x')
K.<a,b> = NumberField([x^2 + 1, x^2 + 2])
A = K.absolute_field('z')
I = A.factor(7)[0][0]
from_A, to_A = A.structure()
G = [from_A(z) for z in I.gens()]; G
K.fractional_ideal(G)
K.fractional_ideal(G).absolute_norm().factor()

AUTHORS:

  • Steven Sivek (2005-05-16)

  • William Stein (2007-09-06)

  • Nick Alexander (2009-01)

class sage.rings.number_field.number_field_ideal_rel.NumberFieldFractionalIdeal_rel(field, gens, coerce=True)[source]

Bases: NumberFieldFractionalIdeal

An ideal of a relative number field.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField([x^2 + 1, x^2 + 2]); K
Number Field in a0 with defining polynomial x^2 + 1 over its base field
sage: i = K.ideal(38); i
Fractional ideal (38)

sage: K.<a0, a1> = NumberField([x^2 + 1, x^2 + 2]); K
Number Field in a0 with defining polynomial x^2 + 1 over its base field
sage: i = K.ideal([a0+1]); i # random
Fractional ideal (-a1*a0)
sage: (g, ) = i.gens_reduced(); g # random
-a1*a0
sage: (g / (a0 + 1)).is_integral()
True
sage: ((a0 + 1) / g).is_integral()
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) + Integer(2)], names=('a',)); (a,) = K._first_ngens(1); K
Number Field in a0 with defining polynomial x^2 + 1 over its base field
>>> i = K.ideal(Integer(38)); i
Fractional ideal (38)

>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) + Integer(2)], names=('a0', 'a1',)); (a0, a1,) = K._first_ngens(2); K
Number Field in a0 with defining polynomial x^2 + 1 over its base field
>>> i = K.ideal([a0+Integer(1)]); i # random
Fractional ideal (-a1*a0)
>>> (g, ) = i.gens_reduced(); g # random
-a1*a0
>>> (g / (a0 + Integer(1))).is_integral()
True
>>> ((a0 + Integer(1)) / g).is_integral()
True
x = polygen(ZZ, 'x')
K.<a> = NumberField([x^2 + 1, x^2 + 2]); K
i = K.ideal(38); i
K.<a0, a1> = NumberField([x^2 + 1, x^2 + 2]); K
i = K.ideal([a0+1]); i # random
(g, ) = i.gens_reduced(); g # random
(g / (a0 + 1)).is_integral()
((a0 + 1) / g).is_integral()
absolute_ideal(names='a')[source]

If this is an ideal in the extension \(L/K\), return the ideal with the same generators in the absolute field \(L/\QQ\).

INPUT:

  • names – (optional) string; name of generator of the absolute field

EXAMPLES:

sage: x = ZZ['x'].0
sage: K.<b> = NumberField(x^2 - 2)
sage: L.<c> = K.extension(x^2 - b)
sage: F.<m> = L.absolute_field()
>>> from sage.all import *
>>> x = ZZ['x'].gen(0)
>>> K = NumberField(x**Integer(2) - Integer(2), names=('b',)); (b,) = K._first_ngens(1)
>>> L = K.extension(x**Integer(2) - b, names=('c',)); (c,) = L._first_ngens(1)
>>> F = L.absolute_field(names=('m',)); (m,) = F._first_ngens(1)
x = ZZ['x'].0
K.<b> = NumberField(x^2 - 2)
L.<c> = K.extension(x^2 - b)
F.<m> = L.absolute_field()

An example of an inert ideal:

sage: P = F.factor(13)[0][0]; P
Fractional ideal (13)
sage: J = L.ideal(13)
sage: J.absolute_ideal()
Fractional ideal (13)
>>> from sage.all import *
>>> P = F.factor(Integer(13))[Integer(0)][Integer(0)]; P
Fractional ideal (13)
>>> J = L.ideal(Integer(13))
>>> J.absolute_ideal()
Fractional ideal (13)
P = F.factor(13)[0][0]; P
J = L.ideal(13)
J.absolute_ideal()

Now a non-trivial ideal in \(L\) that is principal in the subfield \(K\). Since the optional names argument is not passed, the generators of the absolute ideal \(J\) are returned in terms of the default field generator \(a\). This does not agree with the generator \(m\) of the absolute field \(F\) defined above:

sage: J = L.ideal(b); J
Fractional ideal (b)
sage: J.absolute_ideal()
Fractional ideal (a^2)
sage: J.relative_norm()
Fractional ideal (2)
sage: J.absolute_norm()
4
sage: J.absolute_ideal().norm()
4
>>> from sage.all import *
>>> J = L.ideal(b); J
Fractional ideal (b)
>>> J.absolute_ideal()
Fractional ideal (a^2)
>>> J.relative_norm()
Fractional ideal (2)
>>> J.absolute_norm()
4
>>> J.absolute_ideal().norm()
4
J = L.ideal(b); J
J.absolute_ideal()
J.relative_norm()
J.absolute_norm()
J.absolute_ideal().norm()

Now pass \(m\) as the name for the generator of the absolute field:

sage: J.absolute_ideal('m')
Fractional ideal (m^2)
>>> from sage.all import *
>>> J.absolute_ideal('m')
Fractional ideal (m^2)
J.absolute_ideal('m')

Now an ideal not generated by an element of \(K\):

sage: J = L.ideal(c); J
Fractional ideal (c)
sage: J.absolute_ideal()
Fractional ideal (a)
sage: J.absolute_norm()
2
sage: J.ideal_below()
Fractional ideal (b)
sage: J.ideal_below().norm()
2
>>> from sage.all import *
>>> J = L.ideal(c); J
Fractional ideal (c)
>>> J.absolute_ideal()
Fractional ideal (a)
>>> J.absolute_norm()
2
>>> J.ideal_below()
Fractional ideal (b)
>>> J.ideal_below().norm()
2
J = L.ideal(c); J
J.absolute_ideal()
J.absolute_norm()
J.ideal_below()
J.ideal_below().norm()
absolute_norm()[source]

Compute the absolute norm of this fractional ideal in a relative number field, returning a positive integer.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: L.<a, b, c> = QQ.extension([x^2 - 23, x^2 - 5, x^2 - 7])
sage: I = L.ideal(a + b)
sage: I.absolute_norm()
104976
sage: I.relative_norm().relative_norm().relative_norm()
104976
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> L = QQ.extension([x**Integer(2) - Integer(23), x**Integer(2) - Integer(5), x**Integer(2) - Integer(7)], names=('a', 'b', 'c',)); (a, b, c,) = L._first_ngens(3)
>>> I = L.ideal(a + b)
>>> I.absolute_norm()
104976
>>> I.relative_norm().relative_norm().relative_norm()
104976
x = polygen(ZZ, 'x')
L.<a, b, c> = QQ.extension([x^2 - 23, x^2 - 5, x^2 - 7])
I = L.ideal(a + b)
I.absolute_norm()
I.relative_norm().relative_norm().relative_norm()
absolute_ramification_index()[source]

Return the absolute ramification index of this fractional ideal, assuming it is prime. Otherwise, raise a ValueError.

The absolute ramification index is the power of this prime appearing in the factorization of the rational prime that this prime lies over.

Use relative_ramification_index() to obtain the power of this prime occurring in the factorization of the prime ideal of the base field that this prime lies over.

EXAMPLES:

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: I = K.ideal(3, c)
sage: I.absolute_ramification_index()
4
sage: I.smallest_integer()
3
sage: K.ideal(3) == I^4
True
>>> from sage.all import *
>>> PQ = QQ['X']; (X,) = PQ._first_ngens(1)
>>> F = NumberFieldTower([X**Integer(2) - Integer(2), X**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = F._first_ngens(2)
>>> PF = F['Y']; (Y,) = PF._first_ngens(1)
>>> K = F.extension(Y**Integer(2) - (Integer(1) + a)*(a + b)*a*b, names=('c',)); (c,) = K._first_ngens(1)
>>> I = K.ideal(Integer(3), c)
>>> I.absolute_ramification_index()
4
>>> I.smallest_integer()
3
>>> K.ideal(Integer(3)) == I**Integer(4)
True
PQ.<X> = QQ[]
F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
PF.<Y> = F[]
K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
I = K.ideal(3, c)
I.absolute_ramification_index()
I.smallest_integer()
K.ideal(3) == I^4
element_1_mod(other)[source]

Return an element \(r\) in this ideal such that \(1-r\) is in other.

An error is raised if either ideal is not integral of if they are not coprime.

INPUT:

  • other – another ideal of the same field, or generators of an ideal

OUTPUT:

an element \(r\) of the ideal self such that \(1-r\) is in the ideal other.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberFieldTower([x^2 - 23, x^2 + 1])
sage: I = Ideal(2, (a - 3*b + 2)/2)
sage: J = K.ideal(a)
sage: z = I.element_1_mod(J)
sage: z in I
True
sage: 1 - z in J
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberFieldTower([x**Integer(2) - Integer(23), x**Integer(2) + Integer(1)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = Ideal(Integer(2), (a - Integer(3)*b + Integer(2))/Integer(2))
>>> J = K.ideal(a)
>>> z = I.element_1_mod(J)
>>> z in I
True
>>> Integer(1) - z in J
True
x = polygen(ZZ, 'x')
K.<a, b> = NumberFieldTower([x^2 - 23, x^2 + 1])
I = Ideal(2, (a - 3*b + 2)/2)
J = K.ideal(a)
z = I.element_1_mod(J)
z in I
1 - z in J
factor()[source]

Factor the ideal by factoring the corresponding ideal in the absolute number field.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = QQ.extension([x^2 + 11, x^2 - 5])
sage: K.factor(5)
(Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2
 * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2
sage: K.ideal(5).factor()
(Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2
 * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2
sage: K.ideal(5).prime_factors()
[Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4),
 Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4)]

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: I = K.ideal(c)
sage: P = K.ideal((b*a - b - 1)*c/2 + a - 1)
sage: Q = K.ideal((b*a - b - 1)*c/2)
sage: list(I.factor()) == [(P, 2), (Q, 1)]
True
sage: I == P^2*Q
True
sage: [p.is_prime() for p in [P, Q]]
[True, True]
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = QQ.extension([x**Integer(2) + Integer(11), x**Integer(2) - Integer(5)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> K.factor(Integer(5))
(Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2
 * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2
>>> K.ideal(Integer(5)).factor()
(Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2
 * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2
>>> K.ideal(Integer(5)).prime_factors()
[Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4),
 Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4)]

>>> PQ = QQ['X']; (X,) = PQ._first_ngens(1)
>>> F = NumberFieldTower([X**Integer(2) - Integer(2), X**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = F._first_ngens(2)
>>> PF = F['Y']; (Y,) = PF._first_ngens(1)
>>> K = F.extension(Y**Integer(2) - (Integer(1) + a)*(a + b)*a*b, names=('c',)); (c,) = K._first_ngens(1)
>>> I = K.ideal(c)
>>> P = K.ideal((b*a - b - Integer(1))*c/Integer(2) + a - Integer(1))
>>> Q = K.ideal((b*a - b - Integer(1))*c/Integer(2))
>>> list(I.factor()) == [(P, Integer(2)), (Q, Integer(1))]
True
>>> I == P**Integer(2)*Q
True
>>> [p.is_prime() for p in [P, Q]]
[True, True]
x = polygen(ZZ, 'x')
K.<a, b> = QQ.extension([x^2 + 11, x^2 - 5])
K.factor(5)
K.ideal(5).factor()
K.ideal(5).prime_factors()
PQ.<X> = QQ[]
F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
PF.<Y> = F[]
K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
I = K.ideal(c)
P = K.ideal((b*a - b - 1)*c/2 + a - 1)
Q = K.ideal((b*a - b - 1)*c/2)
list(I.factor()) == [(P, 2), (Q, 1)]
I == P^2*Q
[p.is_prime() for p in [P, Q]]
free_module()[source]

Return this ideal as a \(\ZZ\)-submodule of the \(\QQ\)-vector space corresponding to the ambient number field.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^3 - x + 1, x^2 + 23])
sage: I = K.ideal(a*b - 1)
sage: I.free_module()
Free module of degree 6 and rank 6 over Integer Ring
User basis matrix:
...
sage: I.free_module().is_submodule(K.maximal_order().free_module())
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(3) - x + Integer(1), x**Integer(2) + Integer(23)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal(a*b - Integer(1))
>>> I.free_module()
Free module of degree 6 and rank 6 over Integer Ring
User basis matrix:
...
>>> I.free_module().is_submodule(K.maximal_order().free_module())
True
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^3 - x + 1, x^2 + 23])
I = K.ideal(a*b - 1)
I.free_module()
I.free_module().is_submodule(K.maximal_order().free_module())
gens_reduced()[source]

Return a small set of generators for this ideal. This will always return a single generator if one exists (i.e. if the ideal is principal), and otherwise two generators.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 + 1, x^2 - 2])
sage: I = K.ideal((a + 1)*b/2 + 1)
sage: I.gens_reduced()
(1/2*b*a + 1/2*b + 1,)
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) - Integer(2)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal((a + Integer(1))*b/Integer(2) + Integer(1))
>>> I.gens_reduced()
(1/2*b*a + 1/2*b + 1,)
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 + 1, x^2 - 2])
I = K.ideal((a + 1)*b/2 + 1)
I.gens_reduced()
ideal_below()[source]

Compute the ideal of \(K\) below this ideal of \(L\).

EXAMPLES:

sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^2 + 6)
sage: L.<b> = K.extension(K['x'].gen()^4 + a)
sage: N = L.ideal(b)
sage: M = N.ideal_below(); M == K.ideal([-a])
True
sage: Np = L.ideal([L(t) for t in M.gens()])
sage: Np.ideal_below() == M
True
sage: M.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 6
sage: M.ring()
Number Field in a with defining polynomial x^2 + 6
sage: M.ring() is K
True
>>> from sage.all import *
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> K = NumberField(x**Integer(2) + Integer(6), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.extension(K['x'].gen()**Integer(4) + a, names=('b',)); (b,) = L._first_ngens(1)
>>> N = L.ideal(b)
>>> M = N.ideal_below(); M == K.ideal([-a])
True
>>> Np = L.ideal([L(t) for t in M.gens()])
>>> Np.ideal_below() == M
True
>>> M.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 6
>>> M.ring()
Number Field in a with defining polynomial x^2 + 6
>>> M.ring() is K
True
R.<x> = QQ[]
K.<a> = NumberField(x^2 + 6)
L.<b> = K.extension(K['x'].gen()^4 + a)
N = L.ideal(b)
M = N.ideal_below(); M == K.ideal([-a])
Np = L.ideal([L(t) for t in M.gens()])
Np.ideal_below() == M
M.parent()
M.ring()
M.ring() is K

This example concerns an inert ideal:

sage: K = NumberField(x^4 + 6*x^2 + 24, 'a')
sage: K.factor(7)
Fractional ideal (7)
sage: K0, K0_into_K, _ = K.subfields(2)[0]
sage: K0
Number Field in a0 with defining polynomial x^2 - 6*x + 24
sage: L = K.relativize(K0_into_K, 'c'); L
Number Field in c with defining polynomial x^2 + a0 over its base field
sage: L.base_field() is K0
True
sage: L.ideal(7)
Fractional ideal (7)
sage: L.ideal(7).ideal_below()
Fractional ideal (7)
sage: L.ideal(7).ideal_below().number_field() is K0
True
>>> from sage.all import *
>>> K = NumberField(x**Integer(4) + Integer(6)*x**Integer(2) + Integer(24), 'a')
>>> K.factor(Integer(7))
Fractional ideal (7)
>>> K0, K0_into_K, _ = K.subfields(Integer(2))[Integer(0)]
>>> K0
Number Field in a0 with defining polynomial x^2 - 6*x + 24
>>> L = K.relativize(K0_into_K, 'c'); L
Number Field in c with defining polynomial x^2 + a0 over its base field
>>> L.base_field() is K0
True
>>> L.ideal(Integer(7))
Fractional ideal (7)
>>> L.ideal(Integer(7)).ideal_below()
Fractional ideal (7)
>>> L.ideal(Integer(7)).ideal_below().number_field() is K0
True
K = NumberField(x^4 + 6*x^2 + 24, 'a')
K.factor(7)
K0, K0_into_K, _ = K.subfields(2)[0]
K0
L = K.relativize(K0_into_K, 'c'); L
L.base_field() is K0
L.ideal(7)
L.ideal(7).ideal_below()
L.ideal(7).ideal_below().number_field() is K0

This example concerns an ideal that splits in the quadratic field but each factor ideal remains inert in the extension:

sage: len(K.factor(19))
2
sage: K0 = L.base_field(); a0 = K0.gen()
sage: len(K0.factor(19))
2
sage: w1 = -a0 + 1; P1 = K0.ideal([w1])
sage: P1.norm().factor(), P1.is_prime()
(19, True)
sage: L_into_K, K_into_L = L.structure()
sage: L.ideal(K_into_L(K0_into_K(w1))).ideal_below() == P1
True
>>> from sage.all import *
>>> len(K.factor(Integer(19)))
2
>>> K0 = L.base_field(); a0 = K0.gen()
>>> len(K0.factor(Integer(19)))
2
>>> w1 = -a0 + Integer(1); P1 = K0.ideal([w1])
>>> P1.norm().factor(), P1.is_prime()
(19, True)
>>> L_into_K, K_into_L = L.structure()
>>> L.ideal(K_into_L(K0_into_K(w1))).ideal_below() == P1
True
len(K.factor(19))
K0 = L.base_field(); a0 = K0.gen()
len(K0.factor(19))
w1 = -a0 + 1; P1 = K0.ideal([w1])
P1.norm().factor(), P1.is_prime()
L_into_K, K_into_L = L.structure()
L.ideal(K_into_L(K0_into_K(w1))).ideal_below() == P1

The choice of embedding of quadratic field into quartic field matters:

sage: rho, tau = K0.embeddings(K)
sage: L1 = K.relativize(rho, 'b')
sage: L2 = K.relativize(tau, 'b')
sage: L1_into_K, K_into_L1 = L1.structure()
sage: L2_into_K, K_into_L2 = L2.structure()
sage: a = K.gen()
sage: P = K.ideal([a^2 + 5])
sage: K_into_L1(P).ideal_below() == K0.ideal([-a0 + 1])
True
sage: K_into_L2(P).ideal_below() == K0.ideal([-a0 + 5])
True
sage: K0.ideal([-a0 + 1]) == K0.ideal([-a0 + 5])
False
>>> from sage.all import *
>>> rho, tau = K0.embeddings(K)
>>> L1 = K.relativize(rho, 'b')
>>> L2 = K.relativize(tau, 'b')
>>> L1_into_K, K_into_L1 = L1.structure()
>>> L2_into_K, K_into_L2 = L2.structure()
>>> a = K.gen()
>>> P = K.ideal([a**Integer(2) + Integer(5)])
>>> K_into_L1(P).ideal_below() == K0.ideal([-a0 + Integer(1)])
True
>>> K_into_L2(P).ideal_below() == K0.ideal([-a0 + Integer(5)])
True
>>> K0.ideal([-a0 + Integer(1)]) == K0.ideal([-a0 + Integer(5)])
False
rho, tau = K0.embeddings(K)
L1 = K.relativize(rho, 'b')
L2 = K.relativize(tau, 'b')
L1_into_K, K_into_L1 = L1.structure()
L2_into_K, K_into_L2 = L2.structure()
a = K.gen()
P = K.ideal([a^2 + 5])
K_into_L1(P).ideal_below() == K0.ideal([-a0 + 1])
K_into_L2(P).ideal_below() == K0.ideal([-a0 + 5])
K0.ideal([-a0 + 1]) == K0.ideal([-a0 + 5])

It works when the base field is itself a relative number field:

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: I = K.ideal(3, c)
sage: J = I.ideal_below()
sage: J == K.ideal(b)
True
sage: J.number_field() == F
True
>>> from sage.all import *
>>> PQ = QQ['X']; (X,) = PQ._first_ngens(1)
>>> F = NumberFieldTower([X**Integer(2) - Integer(2), X**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = F._first_ngens(2)
>>> PF = F['Y']; (Y,) = PF._first_ngens(1)
>>> K = F.extension(Y**Integer(2) - (Integer(1) + a)*(a + b)*a*b, names=('c',)); (c,) = K._first_ngens(1)
>>> I = K.ideal(Integer(3), c)
>>> J = I.ideal_below()
>>> J == K.ideal(b)
True
>>> J.number_field() == F
True
PQ.<X> = QQ[]
F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
PF.<Y> = F[]
K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
I = K.ideal(3, c)
J = I.ideal_below()
J == K.ideal(b)
J.number_field() == F

Number fields defined by non-monic and non-integral polynomials are supported (Issue #252):

sage: K.<a> = NumberField(2*x^2 - 1/3)
sage: L.<b> = K.extension(5*x^2 + 1)
sage: P = L.primes_above(2)[0]
sage: P.ideal_below()
Fractional ideal (6*a + 2)
>>> from sage.all import *
>>> K = NumberField(Integer(2)*x**Integer(2) - Integer(1)/Integer(3), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.extension(Integer(5)*x**Integer(2) + Integer(1), names=('b',)); (b,) = L._first_ngens(1)
>>> P = L.primes_above(Integer(2))[Integer(0)]
>>> P.ideal_below()
Fractional ideal (6*a + 2)
K.<a> = NumberField(2*x^2 - 1/3)
L.<b> = K.extension(5*x^2 + 1)
P = L.primes_above(2)[0]
P.ideal_below()
integral_basis()[source]

Return a basis for self as a \(\ZZ\)-module.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a,b> = NumberField([x^2 + 1, x^2 - 3])
sage: I = K.ideal(17*b - 3*a)
sage: x = I.integral_basis(); x  # random
[438, -b*a + 309, 219*a - 219*b, 156*a - 154*b]
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal(Integer(17)*b - Integer(3)*a)
>>> x = I.integral_basis(); x  # random
[438, -b*a + 309, 219*a - 219*b, 156*a - 154*b]
x = polygen(ZZ, 'x')
K.<a,b> = NumberField([x^2 + 1, x^2 - 3])
I = K.ideal(17*b - 3*a)
x = I.integral_basis(); x  # random

The exact results are somewhat unpredictable, hence the # random flag, but we can test that they are indeed a basis:

sage: V, _, phi = K.absolute_vector_space()
sage: V.span([phi(u) for u in x], ZZ) == I.free_module()
True
>>> from sage.all import *
>>> V, _, phi = K.absolute_vector_space()
>>> V.span([phi(u) for u in x], ZZ) == I.free_module()
True
V, _, phi = K.absolute_vector_space()
V.span([phi(u) for u in x], ZZ) == I.free_module()
integral_split()[source]

Return a tuple \((I, d)\), where \(I\) is an integral ideal, and \(d\) is the smallest positive integer such that this ideal is equal to \(I/d\).

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberFieldTower([x^2 - 23, x^2 + 1])
sage: I = K.ideal([a + b/3])
sage: J, d = I.integral_split()
sage: J.is_integral()
True
sage: J == d*I
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberFieldTower([x**Integer(2) - Integer(23), x**Integer(2) + Integer(1)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal([a + b/Integer(3)])
>>> J, d = I.integral_split()
>>> J.is_integral()
True
>>> J == d*I
True
x = polygen(ZZ, 'x')
K.<a, b> = NumberFieldTower([x^2 - 23, x^2 + 1])
I = K.ideal([a + b/3])
J, d = I.integral_split()
J.is_integral()
J == d*I
is_integral()[source]

Return True if this ideal is integral.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = QQ.extension([x^2 + 11, x^2 - 5])
sage: I = K.ideal(7).prime_factors()[0]
sage: I.is_integral()
True
sage: (I/2).is_integral()
False
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = QQ.extension([x**Integer(2) + Integer(11), x**Integer(2) - Integer(5)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal(Integer(7)).prime_factors()[Integer(0)]
>>> I.is_integral()
True
>>> (I/Integer(2)).is_integral()
False
x = polygen(ZZ, 'x')
K.<a, b> = QQ.extension([x^2 + 11, x^2 - 5])
I = K.ideal(7).prime_factors()[0]
I.is_integral()
(I/2).is_integral()
is_prime()[source]

Return True if this ideal of a relative number field is prime.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 - 17, x^3 - 2])
sage: K.ideal(a + b).is_prime()
True
sage: K.ideal(13).is_prime()
False
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) - Integer(17), x**Integer(3) - Integer(2)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> K.ideal(a + b).is_prime()
True
>>> K.ideal(Integer(13)).is_prime()
False
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 - 17, x^3 - 2])
K.ideal(a + b).is_prime()
K.ideal(13).is_prime()
is_principal(proof=None)[source]

Return True if this ideal is principal. If so, set self.__reduced_generators, with length one.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 - 23, x^2 + 1])
sage: I = K.ideal([7, (-1/2*b - 3/2)*a + 3/2*b + 9/2])
sage: I.is_principal()
True
sage: I # random
Fractional ideal ((1/2*b + 1/2)*a - 3/2*b - 3/2)
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) - Integer(23), x**Integer(2) + Integer(1)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal([Integer(7), (-Integer(1)/Integer(2)*b - Integer(3)/Integer(2))*a + Integer(3)/Integer(2)*b + Integer(9)/Integer(2)])
>>> I.is_principal()
True
>>> I # random
Fractional ideal ((1/2*b + 1/2)*a - 3/2*b - 3/2)
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 - 23, x^2 + 1])
I = K.ideal([7, (-1/2*b - 3/2)*a + 3/2*b + 9/2])
I.is_principal()
I # random
is_zero()[source]

Return True if this is the zero ideal.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 + 3, x^3 + 4])
sage: K.ideal(17).is_zero()
False
sage: K.ideal(0).is_zero()
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(3), x**Integer(3) + Integer(4)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> K.ideal(Integer(17)).is_zero()
False
>>> K.ideal(Integer(0)).is_zero()
True
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 + 3, x^3 + 4])
K.ideal(17).is_zero()
K.ideal(0).is_zero()
norm()[source]

The norm of a fractional ideal in a relative number field is deliberately unimplemented, so that a user cannot mistake the absolute norm for the relative norm, or vice versa.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 + 1, x^2 - 2])
sage: K.ideal(2).norm()
Traceback (most recent call last):
...
NotImplementedError: For a fractional ideal in a relative number field
you must use relative_norm or absolute_norm as appropriate
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) - Integer(2)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> K.ideal(Integer(2)).norm()
Traceback (most recent call last):
...
NotImplementedError: For a fractional ideal in a relative number field
you must use relative_norm or absolute_norm as appropriate
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 + 1, x^2 - 2])
K.ideal(2).norm()
pari_rhnf()[source]

Return PARI’s representation of this relative ideal in Hermite normal form.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 + 23, x^2 - 7])
sage: I = K.ideal(2, (a + 2*b + 3)/2)
sage: I.pari_rhnf()
[[1, -2; 0, 1], [[2, 1; 0, 1], 1/2]]
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(23), x**Integer(2) - Integer(7)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal(Integer(2), (a + Integer(2)*b + Integer(3))/Integer(2))
>>> I.pari_rhnf()
[[1, -2; 0, 1], [[2, 1; 0, 1], 1/2]]
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 + 23, x^2 - 7])
I = K.ideal(2, (a + 2*b + 3)/2)
I.pari_rhnf()
ramification_index()[source]

For ideals in relative number fields, ramification_index() is deliberately not implemented in order to avoid ambiguity. Either relative_ramification_index() or absolute_ramification_index() should be used instead.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 + 1, x^2 - 2])
sage: K.ideal(2).ramification_index()
Traceback (most recent call last):
...
NotImplementedError: For an ideal in a relative number field you must use
relative_ramification_index or absolute_ramification_index as appropriate
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) + Integer(1), x**Integer(2) - Integer(2)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> K.ideal(Integer(2)).ramification_index()
Traceback (most recent call last):
...
NotImplementedError: For an ideal in a relative number field you must use
relative_ramification_index or absolute_ramification_index as appropriate
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 + 1, x^2 - 2])
K.ideal(2).ramification_index()
relative_norm()[source]

Compute the relative norm of this fractional ideal in a relative number field, returning an ideal in the base field.

EXAMPLES:

sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^2 + 6)
sage: L.<b> = K.extension(K['x'].gen()^4 + a)
sage: N = L.ideal(b).relative_norm(); N
Fractional ideal (-a)
sage: N.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 6
sage: N.ring()
Number Field in a with defining polynomial x^2 + 6
sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: K.ideal(1).relative_norm()
Fractional ideal (1)
sage: K.ideal(13).relative_norm().relative_norm()
Fractional ideal (28561)
sage: K.ideal(13).relative_norm().relative_norm().relative_norm()
815730721
sage: K.ideal(13).absolute_norm()
815730721
>>> from sage.all import *
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> K = NumberField(x**Integer(2) + Integer(6), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.extension(K['x'].gen()**Integer(4) + a, names=('b',)); (b,) = L._first_ngens(1)
>>> N = L.ideal(b).relative_norm(); N
Fractional ideal (-a)
>>> N.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 6
>>> N.ring()
Number Field in a with defining polynomial x^2 + 6
>>> PQ = QQ['X']; (X,) = PQ._first_ngens(1)
>>> F = NumberField([X**Integer(2) - Integer(2), X**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = F._first_ngens(2)
>>> PF = F['Y']; (Y,) = PF._first_ngens(1)
>>> K = F.extension(Y**Integer(2) - (Integer(1) + a)*(a + b)*a*b, names=('c',)); (c,) = K._first_ngens(1)
>>> K.ideal(Integer(1)).relative_norm()
Fractional ideal (1)
>>> K.ideal(Integer(13)).relative_norm().relative_norm()
Fractional ideal (28561)
>>> K.ideal(Integer(13)).relative_norm().relative_norm().relative_norm()
815730721
>>> K.ideal(Integer(13)).absolute_norm()
815730721
R.<x> = QQ[]
K.<a> = NumberField(x^2 + 6)
L.<b> = K.extension(K['x'].gen()^4 + a)
N = L.ideal(b).relative_norm(); N
N.parent()
N.ring()
PQ.<X> = QQ[]
F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
PF.<Y> = F[]
K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
K.ideal(1).relative_norm()
K.ideal(13).relative_norm().relative_norm()
K.ideal(13).relative_norm().relative_norm().relative_norm()
K.ideal(13).absolute_norm()

Number fields defined by non-monic and non-integral polynomials are supported (Issue #252):

sage: K.<a> = NumberField(2*x^2 - 1/3)
sage: L.<b> = K.extension(5*x^2 + 1)
sage: P = L.primes_above(2)[0]
sage: P.relative_norm()
Fractional ideal (6*a + 2)
>>> from sage.all import *
>>> K = NumberField(Integer(2)*x**Integer(2) - Integer(1)/Integer(3), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.extension(Integer(5)*x**Integer(2) + Integer(1), names=('b',)); (b,) = L._first_ngens(1)
>>> P = L.primes_above(Integer(2))[Integer(0)]
>>> P.relative_norm()
Fractional ideal (6*a + 2)
K.<a> = NumberField(2*x^2 - 1/3)
L.<b> = K.extension(5*x^2 + 1)
P = L.primes_above(2)[0]
P.relative_norm()
relative_ramification_index()[source]

Return the relative ramification index of this fractional ideal, assuming it is prime. Otherwise, raise a ValueError.

The relative ramification index is the power of this prime appearing in the factorization of the prime ideal of the base field that this prime lies over.

Use absolute_ramification_index() to obtain the power of this prime occurring in the factorization of the rational prime that this prime lies over.

EXAMPLES:

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: I = K.ideal(3, c)
sage: I.relative_ramification_index()
2
sage: I.ideal_below()  # random sign
Fractional ideal (b)
sage: I.ideal_below() == K.ideal(b)
True
sage: K.ideal(b) == I^2
True
>>> from sage.all import *
>>> PQ = QQ['X']; (X,) = PQ._first_ngens(1)
>>> F = NumberFieldTower([X**Integer(2) - Integer(2), X**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = F._first_ngens(2)
>>> PF = F['Y']; (Y,) = PF._first_ngens(1)
>>> K = F.extension(Y**Integer(2) - (Integer(1) + a)*(a + b)*a*b, names=('c',)); (c,) = K._first_ngens(1)
>>> I = K.ideal(Integer(3), c)
>>> I.relative_ramification_index()
2
>>> I.ideal_below()  # random sign
Fractional ideal (b)
>>> I.ideal_below() == K.ideal(b)
True
>>> K.ideal(b) == I**Integer(2)
True
PQ.<X> = QQ[]
F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
PF.<Y> = F[]
K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
I = K.ideal(3, c)
I.relative_ramification_index()
I.ideal_below()  # random sign
I.ideal_below() == K.ideal(b)
K.ideal(b) == I^2
residue_class_degree()[source]

Return the residue class degree of this prime.

EXAMPLES:

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: [I.residue_class_degree() for I in K.ideal(c).prime_factors()]
[1, 2]
>>> from sage.all import *
>>> PQ = QQ['X']; (X,) = PQ._first_ngens(1)
>>> F = NumberFieldTower([X**Integer(2) - Integer(2), X**Integer(2) - Integer(3)], names=('a', 'b',)); (a, b,) = F._first_ngens(2)
>>> PF = F['Y']; (Y,) = PF._first_ngens(1)
>>> K = F.extension(Y**Integer(2) - (Integer(1) + a)*(a + b)*a*b, names=('c',)); (c,) = K._first_ngens(1)
>>> [I.residue_class_degree() for I in K.ideal(c).prime_factors()]
[1, 2]
PQ.<X> = QQ[]
F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
PF.<Y> = F[]
K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
[I.residue_class_degree() for I in K.ideal(c).prime_factors()]
residues()[source]

Return a iterator through a complete list of residues modulo this integral ideal.

An error is raised if this fractional ideal is not integral.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, w> = NumberFieldTower([x^2 - 3, x^2 + x + 1])
sage: I = K.ideal(6, -w*a - w + 4)
sage: list(I.residues())[:5]
[(25/3*w - 1/3)*a + 22*w + 1,
(16/3*w - 1/3)*a + 13*w,
(7/3*w - 1/3)*a + 4*w - 1,
(-2/3*w - 1/3)*a - 5*w - 2,
(-11/3*w - 1/3)*a - 14*w - 3]
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberFieldTower([x**Integer(2) - Integer(3), x**Integer(2) + x + Integer(1)], names=('a', 'w',)); (a, w,) = K._first_ngens(2)
>>> I = K.ideal(Integer(6), -w*a - w + Integer(4))
>>> list(I.residues())[:Integer(5)]
[(25/3*w - 1/3)*a + 22*w + 1,
(16/3*w - 1/3)*a + 13*w,
(7/3*w - 1/3)*a + 4*w - 1,
(-2/3*w - 1/3)*a - 5*w - 2,
(-11/3*w - 1/3)*a - 14*w - 3]
x = polygen(ZZ, 'x')
K.<a, w> = NumberFieldTower([x^2 - 3, x^2 + x + 1])
I = K.ideal(6, -w*a - w + 4)
list(I.residues())[:5]
smallest_integer()[source]

Return the smallest nonnegative integer in \(I \cap \ZZ\), where \(I\) is this ideal. If \(I = 0\), returns \(0\).

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberFieldTower([x^2 - 23, x^2 + 1])
sage: I = K.ideal([a + b])
sage: I.smallest_integer()
12
sage: [m for m in range(13) if m in I]
[0, 12]
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberFieldTower([x**Integer(2) - Integer(23), x**Integer(2) + Integer(1)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> I = K.ideal([a + b])
>>> I.smallest_integer()
12
>>> [m for m in range(Integer(13)) if m in I]
[0, 12]
x = polygen(ZZ, 'x')
K.<a, b> = NumberFieldTower([x^2 - 23, x^2 + 1])
I = K.ideal([a + b])
I.smallest_integer()
[m for m in range(13) if m in I]
valuation(p)[source]

Return the valuation of this fractional ideal at \(\mathfrak{p}\).

INPUT:

  • p – a prime ideal \(\mathfrak{p}\) of this relative number field

OUTPUT:

(integer) The valuation of this fractional ideal at the prime \(\mathfrak{p}\). If \(\mathfrak{p}\) is not prime, raise a ValueError.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 - 17, x^3 - 2])
sage: A = K.ideal(a + b)
sage: A.is_prime()
True
sage: (A*K.ideal(3)).valuation(A)
1
sage: K.ideal(25).valuation(5)
Traceback (most recent call last):
...
ValueError: p (= Fractional ideal (5)) must be a prime
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(2) - Integer(17), x**Integer(3) - Integer(2)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> A = K.ideal(a + b)
>>> A.is_prime()
True
>>> (A*K.ideal(Integer(3))).valuation(A)
1
>>> K.ideal(Integer(25)).valuation(Integer(5))
Traceback (most recent call last):
...
ValueError: p (= Fractional ideal (5)) must be a prime
x = polygen(ZZ, 'x')
K.<a, b> = NumberField([x^2 - 17, x^3 - 2])
A = K.ideal(a + b)
A.is_prime()
(A*K.ideal(3)).valuation(A)
K.ideal(25).valuation(5)
sage.rings.number_field.number_field_ideal_rel.is_NumberFieldFractionalIdeal_rel(x)[source]

Return True if \(x\) is a fractional ideal of a relative number field.

EXAMPLES:

sage: from sage.rings.number_field.number_field_ideal_rel import is_NumberFieldFractionalIdeal_rel
sage: from sage.rings.number_field.number_field_ideal import is_NumberFieldFractionalIdeal
sage: is_NumberFieldFractionalIdeal_rel(2/3)
doctest:warning...
DeprecationWarning: The function is_NumberFieldFractionalIdeal_rel is deprecated;
use 'isinstance(..., NumberFieldFractionalIdeal_rel' instead.
See https://github.com/sagemath/sage/issues/38124 for details.
False
sage: is_NumberFieldFractionalIdeal_rel(ideal(5))
False
sage: x = polygen(ZZ, 'x')
sage: k.<a> = NumberField(x^2 + 2)
sage: I = k.ideal([a + 1]); I
Fractional ideal (a + 1)
sage: is_NumberFieldFractionalIdeal_rel(I)
False
sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^2 + 6)
sage: L.<b> = K.extension(K['x'].gen()^4 + a)
sage: I = L.ideal(b); I
Fractional ideal (6, b)
sage: is_NumberFieldFractionalIdeal_rel(I)
True
sage: N = I.relative_norm(); N
Fractional ideal (-a)
sage: is_NumberFieldFractionalIdeal_rel(N)
False
>>> from sage.all import *
>>> from sage.rings.number_field.number_field_ideal_rel import is_NumberFieldFractionalIdeal_rel
>>> from sage.rings.number_field.number_field_ideal import is_NumberFieldFractionalIdeal
>>> is_NumberFieldFractionalIdeal_rel(Integer(2)/Integer(3))
doctest:warning...
DeprecationWarning: The function is_NumberFieldFractionalIdeal_rel is deprecated;
use 'isinstance(..., NumberFieldFractionalIdeal_rel' instead.
See https://github.com/sagemath/sage/issues/38124 for details.
False
>>> is_NumberFieldFractionalIdeal_rel(ideal(Integer(5)))
False
>>> x = polygen(ZZ, 'x')
>>> k = NumberField(x**Integer(2) + Integer(2), names=('a',)); (a,) = k._first_ngens(1)
>>> I = k.ideal([a + Integer(1)]); I
Fractional ideal (a + 1)
>>> is_NumberFieldFractionalIdeal_rel(I)
False
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> K = NumberField(x**Integer(2) + Integer(6), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.extension(K['x'].gen()**Integer(4) + a, names=('b',)); (b,) = L._first_ngens(1)
>>> I = L.ideal(b); I
Fractional ideal (6, b)
>>> is_NumberFieldFractionalIdeal_rel(I)
True
>>> N = I.relative_norm(); N
Fractional ideal (-a)
>>> is_NumberFieldFractionalIdeal_rel(N)
False
from sage.rings.number_field.number_field_ideal_rel import is_NumberFieldFractionalIdeal_rel
from sage.rings.number_field.number_field_ideal import is_NumberFieldFractionalIdeal
is_NumberFieldFractionalIdeal_rel(2/3)
is_NumberFieldFractionalIdeal_rel(ideal(5))
x = polygen(ZZ, 'x')
k.<a> = NumberField(x^2 + 2)
I = k.ideal([a + 1]); I
is_NumberFieldFractionalIdeal_rel(I)
R.<x> = QQ[]
K.<a> = NumberField(x^2 + 6)
L.<b> = K.extension(K['x'].gen()^4 + a)
I = L.ideal(b); I
is_NumberFieldFractionalIdeal_rel(I)
N = I.relative_norm(); N
is_NumberFieldFractionalIdeal_rel(N)