Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit d086479

Browse files
committed
34212: clean version
1 parent 12be2d9 commit d086479

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

src/sage/rings/number_field/number_field.py

+67
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
from collections import Counter
154154
from builtins import zip
155155

156+
from sage.categories.homset import Hom
157+
from sage.categories.sets_cat import Sets
158+
from sage.modules.free_module import VectorSpace
159+
from sage.modules.free_module_element import vector
156160

157161
_NumberFields = NumberFields()
158162

@@ -9297,6 +9301,69 @@ def minkowski_embedding(self, B=None, prec=None):
92979301

92989302
return sage.matrix.all.matrix(d)
92999303

9304+
def logarithmic_embedding(self, prec=53):
9305+
"""
9306+
Return the morphism of ``self`` under the logarithmic embedding
9307+
in the category Set.
9308+
9309+
The logarithmic embedding is defined as a map from the number field ``self`` to `\RR^n`.
9310+
9311+
It is defined under Definition 4.9.6 in [Cohen1993]_.
9312+
9313+
INPUT:
9314+
9315+
- ``prec`` -- desired floating point precision.
9316+
9317+
OUTPUT:
9318+
9319+
- a tuple of real numbers.
9320+
9321+
EXAMPLES::
9322+
9323+
sage: CF.<a> = CyclotomicField(97)
9324+
sage: f = CF.logarithmic_embedding()
9325+
sage: f(0)
9326+
(-1)
9327+
sage: f(7)
9328+
(1.94591014905531)
9329+
9330+
::
9331+
9332+
sage: K.<a> = NumberField(x^3 + 5)
9333+
sage: f = K.logarithmic_embedding()
9334+
sage: f(0)
9335+
(-1)
9336+
sage: f(7)
9337+
(1.94591014905531)
9338+
"""
9339+
def closure_map(x, prec=53):
9340+
"""
9341+
The function closure of the logarithmic embedding.
9342+
"""
9343+
K = self.base_ring()
9344+
K_embeddings = K.places(prec)
9345+
r1, r2 = K.signature()
9346+
r = r1 + r2 - 1
9347+
9348+
from sage.rings.all import RealField
9349+
Reals = RealField(prec)
9350+
9351+
if x == 0:
9352+
return vector([-1 for _ in range(r + 1)])
9353+
9354+
x_logs = []
9355+
for i in range(r1):
9356+
sigma = K_embeddings[i]
9357+
x_logs.append(Reals(abs(sigma(x))).log())
9358+
for i in range(r1, r + 1):
9359+
tau = K_embeddings[i]
9360+
x_logs.append(2 * Reals(abs(tau(x))).log())
9361+
9362+
return vector(x_logs)
9363+
9364+
log_map = closure_map(self(0), prec)
9365+
return Hom(self, VectorSpace(QQ, len(log_map)), Sets())
9366+
93009367
def places(self, all_complex=False, prec=None):
93019368
r"""
93029369
Return the collection of all infinite places of self.

0 commit comments

Comments
 (0)