128
128
from sage .misc .functional import is_odd , lift
129
129
130
130
from sage .misc .misc_c import prod
131
- from sage .rings .infinity import Infinity
131
+ from sage .rings .all import Infinity
132
132
from sage .categories .number_fields import NumberFields
133
133
134
134
import sage .rings .ring
156
156
157
157
_NumberFields = NumberFields ()
158
158
159
-
159
+ from sage .categories .homset import Hom
160
+ from sage .categories .sets_cat import Sets
161
+ from sage .modules .free_module import VectorSpace
160
162
from sage .rings .number_field .morphism import RelativeNumberFieldHomomorphism_from_abs
161
163
162
164
@@ -1635,7 +1637,7 @@ def construction(self):
1635
1637
1636
1638
"""
1637
1639
from sage .categories .pushout import AlgebraicExtensionFunctor
1638
- from sage .rings . rational_field import QQ
1640
+ from sage .all import QQ
1639
1641
names = self .variable_names ()
1640
1642
polys = []
1641
1643
embeddings = []
@@ -1765,12 +1767,6 @@ def _element_constructor_(self, x, check=True):
1765
1767
2*I + 1
1766
1768
sage: QQi(vector((RR(1), RR(2))))
1767
1769
2*I + 1
1768
-
1769
- Check that :trac:`34059` is fixed::
1770
-
1771
- sage: K.<a> = NumberField(x)
1772
- sage: K([1]).parent()
1773
- Number Field in a with defining polynomial x
1774
1770
"""
1775
1771
if isinstance (x , number_field_element .NumberFieldElement ):
1776
1772
K = x .parent ()
@@ -1826,7 +1822,10 @@ def _element_constructor_(self, x, check=True):
1826
1822
if len (x ) != self .relative_degree ():
1827
1823
raise ValueError ("Length must be equal to the degree of this number field" )
1828
1824
base = self .base_ring ()
1829
- return sum (base (c ) * g for c , g in zip (x , self .gen (0 ).powers (len (x ))))
1825
+ result = base (x [0 ])
1826
+ for i in range (1 , self .relative_degree ()):
1827
+ result += base (x [i ])* self .gen (0 )** i
1828
+ return result
1830
1829
return self ._convert_non_number_field_element (x )
1831
1830
1832
1831
def _convert_non_number_field_element (self , x ):
@@ -3293,8 +3292,7 @@ def algebraic_closure(self):
3293
3292
sage: K.algebraic_closure()
3294
3293
Algebraic Field
3295
3294
"""
3296
- from sage .rings .qqbar import QQbar
3297
- return QQbar
3295
+ return sage .rings .all .QQbar
3298
3296
3299
3297
@cached_method
3300
3298
def conductor (self , check_abelian = True ):
@@ -4211,7 +4209,7 @@ def _pari_absolute_structure(self):
4211
4209
- ``beta`` is the image of `x \bmod g` under the inverse
4212
4210
isomorphism `\phi^{-1}\colon K[x]/(g) \to K[x]/(f)`
4213
4211
4214
- EXAMPLES:
4212
+ EXAMPLES::
4215
4213
4216
4214
If `f` is monic and integral, the result satisfies ``g = f``
4217
4215
and ``alpha = beta = x``::
@@ -6811,7 +6809,7 @@ def regulator(self, proof=None):
6811
6809
try :
6812
6810
return self .__regulator
6813
6811
except AttributeError :
6814
- from sage .rings .real_mpfr import RealField
6812
+ from sage .rings .all import RealField
6815
6813
k = self .pari_bnf (proof )
6816
6814
self .__regulator = RealField (53 )(k .bnf_get_reg ())
6817
6815
return self .__regulator
@@ -8120,8 +8118,7 @@ def _coerce_from_other_number_field(self, x):
8120
8118
8121
8119
# Do not use CDF or RDF because of constraints on the
8122
8120
# exponent of floating-point numbers
8123
- from sage .rings .complex_mpfr import ComplexField
8124
- from sage .rings .real_mpfr import RealField
8121
+ from sage .rings .all import RealField , ComplexField
8125
8122
CC = ComplexField (53 )
8126
8123
RR = RealField (53 )
8127
8124
@@ -8923,7 +8920,7 @@ def free_module(self, base=None, basis=None, map=True):
8923
8920
if base is None :
8924
8921
base = QQ
8925
8922
elif base is self :
8926
- return super ().free_module (base = base , basis = basis , map = map )
8923
+ return super (NumberField_absolute , self ).free_module (base = base , basis = basis , map = map )
8927
8924
if basis is not None or base is not QQ :
8928
8925
raise NotImplementedError
8929
8926
V = QQ ** self .degree ()
@@ -9297,6 +9294,45 @@ def minkowski_embedding(self, B=None, prec=None):
9297
9294
9298
9295
return sage .matrix .all .matrix (d )
9299
9296
9297
+ def logarithmic_embedding (self , prec = 53 ):
9298
+ """
9299
+ Return the morphism of ``self`` under the logarithmic embedding
9300
+ in the category Set.
9301
+
9302
+ The logarithmic embedding is defined as a map from the number field ``self`` to `\RR^n`.
9303
+
9304
+ It is defined under Definition 4.9.6 in [Cohen1993]_.
9305
+
9306
+ INPUT:
9307
+
9308
+ - ``prec`` -- desired floating point precision.
9309
+
9310
+ OUTPUT:
9311
+
9312
+ - a tuple of real numbers.
9313
+
9314
+ EXAMPLES::
9315
+
9316
+ sage: CF.<a> = CyclotomicField(97)
9317
+ sage: f = CF.logarithmic_embedding()
9318
+ sage: f(0)
9319
+ (-1)
9320
+ sage: f(7)
9321
+ (1.94591014905531)
9322
+
9323
+ ::
9324
+
9325
+ sage: K.<a> = NumberField(x^3 + 5)
9326
+ sage: f = K.logarithmic_embedding()
9327
+ sage: f(0)
9328
+ (-1)
9329
+ sage: f(7)
9330
+ (1.94591014905531)
9331
+ """
9332
+ log_map = self (0 )._logarithmic_embedding_helper (prec )
9333
+ log_hom = Hom (self , VectorSpace (QQ , len (log_map (0 ))), Sets ())
9334
+ return log_hom (log_map )
9335
+
9300
9336
def places (self , all_complex = False , prec = None ):
9301
9337
r"""
9302
9338
Return the collection of all infinite places of self.
@@ -9374,9 +9410,8 @@ def places(self, all_complex=False, prec=None):
9374
9410
C = sage .rings .complex_double .CDF
9375
9411
9376
9412
elif prec == Infinity :
9377
- from sage .rings .qqbar import AA , QQbar
9378
- R = AA
9379
- C = QQbar
9413
+ R = sage .rings .all .AA
9414
+ C = sage .rings .all .QQbar
9380
9415
9381
9416
else :
9382
9417
R = sage .rings .real_mpfr .RealField (prec )
@@ -9673,8 +9708,7 @@ def relativize(self, alpha, names, structure=None):
9673
9708
# step 1: construct the abstract field generated by alpha.w
9674
9709
# step 2: make a relative extension of it.
9675
9710
# step 3: construct isomorphisms
9676
- from sage .matrix .constructor import matrix
9677
- from sage .modules .free_module_element import vector
9711
+ from sage .all import vector , matrix
9678
9712
9679
9713
from sage .categories .map import is_Map
9680
9714
if is_Map (alpha ):
@@ -9684,7 +9718,7 @@ def relativize(self, alpha, names, structure=None):
9684
9718
L = alpha .domain ()
9685
9719
alpha = alpha (L .gen ()) # relativize over phi's domain
9686
9720
if L is QQ :
9687
- from sage .rings .polynomial . polynomial_ring import polygen
9721
+ from sage .rings .all import polygen
9688
9722
f = polygen (QQ )
9689
9723
else :
9690
9724
f = L .defining_polynomial () # = alpha.minpoly()
@@ -10040,13 +10074,13 @@ def hilbert_symbol(self, a, b, P = None):
10040
10074
return pari (self ).nfhilbert (a , b )
10041
10075
10042
10076
from sage .categories .map import Map
10043
- from sage .categories .rings import Rings
10077
+ from sage .categories .all import Rings
10044
10078
if isinstance (P , Map ) and P .category_for ().is_subcategory (Rings ()):
10045
10079
# P is a morphism of Rings
10046
10080
if P .domain () is not self :
10047
10081
raise ValueError ("Domain of P (=%s) should be self (=%s) in self.hilbert_symbol" % (P , self ))
10048
10082
codom = P .codomain ()
10049
- from sage .rings .qqbar import AA , QQbar
10083
+ from sage .rings .all import ( AA , QQbar )
10050
10084
if isinstance (codom , (sage .rings .abc .ComplexField , sage .rings .abc .ComplexDoubleField , sage .rings .abc .ComplexIntervalField )) or \
10051
10085
codom is QQbar :
10052
10086
if P (self .gen ()).imag () == 0 :
@@ -11420,7 +11454,7 @@ def embeddings(self, K):
11420
11454
v = []
11421
11455
except AttributeError :
11422
11456
# zeta not defined
11423
- return super ().embeddings (K )
11457
+ return super (NumberField_cyclotomic , self ).embeddings (K )
11424
11458
else :
11425
11459
X = [m for m in range (n ) if arith .gcd (m ,n ) == 1 ]
11426
11460
v = [self .hom ([z ** i ], check = False ) for i in X ]
0 commit comments