# Revision history [back]

### How to extend ring homomorphism to polynomial ring (or its fraction field)

I have a homomorphism from a number field nf to the field of algebraic numbers QQbar:

nf, alpha, hom = QQbar(sqrt(2)).as_number_field_element()

I now work in the polynomial ring R over nf:

R.<x> = nf[]

f = x - alpha; f

How do I get a homomorphism from R to the polynomial ring over QQbar extending hom? For the moment, I can use

f.map_coefficients(hom)

Same question about the fraction field of R, e.g.,

g = f/(x+1)

Is there a more elegant way than calling

g.numerator().map_coefficients(hom)/g.denominator().map_coefficients(hom)

So basically, I'd like to extend my homomorphism hom to the polynomial ring and its field of fractions.