Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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?