Homomorphisms for relative number fields
How can I define a homomorphism from a relative number field K (containing F)
to some other field L if I know where to send K.gens()?
Example:
F_pol = x^2-x-1
F = NumberField(F_pol, 'lam')
K_pol = x^2 + 4
K = F.extension(K_pol, 'e')
L = QQbar
lam_im = L(F_pol.roots()[1][0])
e_im = L(K_pol.roots()[1][0])
Wrong result:
K.hom([e_im], QQbar, check=False)
What we want (not working):
K.hom([e_im, lam_im], QQbar, check=False)
A working solution (edit):
K.Hom(L)(e_im, F.hom([lam_im], check=False))
New question/example: What if L is not exact?
x = PolynomialRing(QQ,'x').gen()
F_pol = x^3 - x^2 - 2*x + 1
F.<lam> = NumberField(F_pol, 'lam')
D = 4*lam^2 + 4*lam - 4
K_pol = x^2 - D
K = F.extension(K_pol, 'e')
L = CC
lam_im = F_pol.roots(L)[2][0]
e_im = F.hom([lam_im], check=False)(D).sqrt()
K.Hom(L)(e_im, F.hom([lam_im], check=False), check=False)
This gives the error:
TypeError: images do not define a valid homomorphism