Ask Your Question

Revision history [back]

First you need to write

sage: lam_im = F_pol.roots(L)[1][0]
sage: e_im = K_pol.roots(L)[1][0]

Then the following works

sage: HomKL = K.Hom(L)
sage: HomKL(e_im, F.hom([lam_im]))
Relative number field morphism:
  From: Number Field in e with defining polynomial x^2 + 4 over its base field
  To:   Algebraic Field
  Defn: e |--> 0.?e-53 + 2.000000000000000?*I
        lam |--> 1.618033988749895? + 0.?e-53*I

Typing

sage: HomKL.__call__?

explains the syntax. There should be an easier way to do this.

First you need to write

sage: lam_im = F_pol.roots(L)[1][0]
sage: e_im = K_pol.roots(L)[1][0]

Then the following works

sage: HomKL = K.Hom(L)
sage: HomKL(e_im, F.hom([lam_im]))
Relative number field morphism:
  From: Number Field in e with defining polynomial x^2 + 4 over its base field
  To:   Algebraic Field
  Defn: e |--> 0.?e-53 + 2.000000000000000?*I
        lam |--> 1.618033988749895? + 0.?e-53*I

Typing

sage: HomKL.__call__?

explains the syntax. There should be an easier way to do this.

On the second question

This is a bug, the check parameter does not get passed on as it should be. I will raise a ticket to deal with this, but in the meantime you can get the result you want as follows.

sage: K_abs = K.absolute_field('a')
sage: from_abs = K_abs.structure()[0]
sage: a = from_abs(K_abs.gen())
sage: R = L['x']
sage: f = R(map(F.hom([lam_im], check=False), a))
sage: abs_hom = K_abs.hom([f(e_im)], check=False)
sage: from sage.rings.number_field.morphism import RelativeNumberFieldHomomorphism_from_abs
sage: RelativeNumberFieldHomomorphism_from_abs(K.Hom(L), abs_hom)
Relative number field morphism:
  From: Number Field in e with defining polynomial x^2 - 4*lam^2 - 4*lam + 4 over its base field
  To:   Complex Field with 53 bits of precision
  Defn: e |--> 4.02438434522465
        lam |--> 1.80193773580484

This is taken, with some slight modifications, from the code for _from_im in sage/rings/number_field/morphism.py, the key difference being the addition of check=False where abs_hom is defined.