@@ -1637,19 +1637,18 @@ cdef class NumberFieldElement(FieldElement):
1637
1637
sage: K. <a> = NumberField( x^ 3 + x + 1)
1638
1638
sage: Q. <X> = K[]
1639
1639
sage: L. <b> = NumberField( X^ 4 + a)
1640
- sage: t = ( -a) . is_norm( L, element=True) ; t
1641
- ( True, - b^ 3 - 1 )
1642
- sage: t[ 1 ] . norm( K)
1643
- -a
1640
+ sage: t, u = ( -a) . is_norm( L, element=True) ; u # random ( not unique )
1641
+ b^ 3 + 1
1642
+ sage: t and u . norm( K) == -a
1643
+ True
1644
1644
1645
1645
Verify that :trac:`27469` has been fixed::
1646
1646
1647
1647
sage: L. <z24> = CyclotomicField( 24) ; L
1648
1648
Cyclotomic Field of order 24 and degree 8
1649
1649
sage: K = L. subfield( z24^ 3, 'z8') [0 ]; K
1650
1650
Number Field in z8 with defining polynomial x^ 4 + 1 with z8 = 0. 7071067811865475? + 0. 7071067811865475?* I
1651
- sage: flag, c = K( -7) . is_norm( K, element=True)
1652
- sage: flag
1651
+ sage: flag, c = K( -7) . is_norm( K, element=True) ; flag
1653
1652
True
1654
1653
sage: c. norm( K)
1655
1654
-7
@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
1746
1745
sage: K. <a> = NumberField( x^ 3 + x^ 2 - 2* x - 1, 'a')
1747
1746
sage: P. <X> = K[]
1748
1747
sage: L = NumberField( X^ 2 + a^ 2 + 2* a + 1, 'b')
1749
- sage: K( 17) . _rnfisnorm( L) # representation depends, not tested
1750
- (( a^ 2 - 2) * b - 4, 1)
1748
+ sage: y, q = K( 17) . _rnfisnorm( L)
1749
+ sage: q==1
1750
+ True
1751
+ sage: y # random ( not unique)
1752
+ ( a^ 2 - 2) * b - 4
1751
1753
1752
1754
sage: K. <a> = NumberField( x^ 3 + x + 1)
1753
1755
sage: Q. <X> = K[]
1754
1756
sage: L. <b> = NumberField( X^ 4 + a)
1755
- sage: t = ( -a) . _rnfisnorm( L) ; t
1756
- ( -b^ 3 - 1, 1)
1757
- sage: t[0 ]. norm( K)
1758
- -a
1759
- sage: t = K( 3) . _rnfisnorm( L) ; t
1757
+ sage: y, q = ( -a) . _rnfisnorm( L)
1758
+ sage: y # random ( not unique)
1759
+ b^ 3 + 1
1760
+ sage: q == 1 and y. norm( K) == -a
1761
+ True
1762
+ sage: y, q = K( 3) . _rnfisnorm( L) ; y, q # random ( not unique)
1760
1763
( b^ 3 + a* b^ 2 + a^ 2* b - 1, 3* a^ 2 - 3* a + 6)
1761
- sage: t[ 0 ] . norm( K) * t[ 1 ]
1762
- 3
1764
+ sage: y . norm( K) * q == 3
1765
+ True
1763
1766
1764
1767
An example where the base field is a relative field::
1765
1768
1766
1769
sage: K. <a, b> = NumberField( [x^2 - 2, x^2 - 3 ])
1767
1770
sage: L. <c> = K. extension( x^ 3 + 2)
1768
1771
sage: s = 2* a + b
1769
- sage: t = s. _rnfisnorm( L)
1770
- sage: t[ 1 ] == 1 # True iff s is a norm
1772
+ sage: y, q = s. _rnfisnorm( L)
1773
+ sage: q == 1 # True iff s is a norm
1771
1774
False
1772
- sage: s == t[ 0 ] . norm( K) * t[ 1 ]
1775
+ sage: s == y . norm( K) * q
1773
1776
True
1774
1777
1775
1778
TESTS:
@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
1779
1782
1780
1783
sage: K. <a> = NumberField( x^ 2 + 1/2)
1781
1784
sage: L. <b> = K. extension( x^ 2 - 1/2)
1782
- sage: a. _rnfisnorm( L)
1785
+ sage: y, q = a. _rnfisnorm( L)
1786
+ sage: y # random ( not unique)
1787
+ q == 1 and y. norm( K) == a
1783
1788
( a* b + a + 1/2, 1)
1784
1789
1785
1790
We test the above doctest, which was not tested.
@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
1788
1793
sage: K. <a> = NumberField( x^ 3 + x^ 2 - 2* x - 1, 'a')
1789
1794
sage: P. <X> = K[]
1790
1795
sage: L. <b> = NumberField( X^ 2 + a^ 2 + 2* a + 1, 'b')
1791
- sage: ( xbar, q) = K( 17) . _rnfisnorm( L)
1792
- sage: q == 1
1793
- 1
1794
- sage: xbar. norm( )
1796
+ sage: y, q = K( 17) . _rnfisnorm( L)
1797
+ sage: y. norm( )
1795
1798
4913
1796
- sage: xbar in (( a^ 2 - 2) * b - 4, ( a^ 2 - 2) * b + 4)
1799
+ sage: q == 1 and y in (( a^ 2 - 2) * b - 4, ( a^ 2 - 2) * b + 4)
1797
1800
True
1798
1801
1799
1802
AUTHORS:
0 commit comments