ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 17 Jun 2018 05:47:03 -0500Possible bug with identity morphismhttp://ask.sagemath.org/question/42625/possible-bug-with-identity-morphism/I have a number field `U` for which I consider its automorphisms through `Hom(U,U)`.
The identity `one=Hom(U,U).identity()` behaves weirdly under right multiplication:
U = CyclotomicField(3)
f = Hom(U,U)[1]
print f
print "--------------------"
one = Hom(U,U).identity()
print f*one
print "--------------------"
print one*f
print "--------------------"
print f*f
When I run this code, I expect `f` to be printed thrice, followed by the identity morphism.
However, while the first and third output do in fact both print `f`, the second prints
Composite map:
From: Cyclotomic Field of order 3 and degree 2
To: Cyclotomic Field of order 3 and degree 2
Defn: Identity endomorphism of Cyclotomic Field of order 3 and degree 2
then
Ring endomorphism of Cyclotomic Field of order 3 and degree 2
Defn: zeta3 |--> -zeta3 - 1
Is this a bug or is this this behaviour explained somewhere in the documentation?
MadPidgeonSun, 17 Jun 2018 05:47:03 -0500http://ask.sagemath.org/question/42625/Computation of homomorphisms of number fieldshttp://ask.sagemath.org/question/40798/computation-of-homomorphisms-of-number-fields/Given two number fields, I want to construct a morphism between them.
For this I tried to use the hom member-function of the NumberField object as follows:
R.<zeta3> = CyclotomicField(3)
P.<X> = PolynomialRing(R)
K.<gen1> = R.extension(X^3-zeta3)
L.<gen2> = R.extension(X^3-zeta3^2)
print K.gens(), L.gens()
H = K.hom( [gen2,zeta3^2], L )
print H
The help page of hom specifies:
> Return the unique homomorphism from self to codomain that
sends ``self.gens()`` to the entries of ``im_gens``.
Raises a TypeError if there is no such homomorphism.
However, instead of TypeError, I get an incomprehensible error:
> File "/home/sage/bin/sage2/local/lib/python2.7/site-packages/sage/rings/number_field/number_field.py", line 1670, in _element_constructor_
raise ValueError("Length must be equal to the degree of this number field")
ValueError: Length must be equal to the degree of this number field
What am I doing wrong? Is there a better way to define this morphism?MadPidgeonSat, 27 Jan 2018 05:24:56 -0600http://ask.sagemath.org/question/40798/