Ask Your Question

# Number field containing real/imaginary part of algebraic number

I have a number field N with an embedding into C (e.g., NumberField(x^3+3, 'z', 0.7+1.2j)). I would like the smallest number field N' that contains all Re(z) and Im(z) for z in N. I would also like a mapping from x in N to (Re(x), Im(x) in N'xN' - or at least know what Re(z) and Im(z) is in N' for the generator z of N.

What is a good way of doing this?

I was thinking along the lines of N.composite_fields(NumberField(N.defining_polynomial, 'z', embedding=ComplexField()(N.gen_embedding()).conjugate()),both_maps=True). But I ran into http://trac.sagemath.org/ticket/14164 with this occasionally. Is there a better way of doing it?

edit retag close merge delete

## 2 answers

Sort by » oldest newest most voted

Here is a solution going through QQbar. You first need to create your element as an element of QQbar as follows

sage: x = polygen(ZZ)
sage: a = QQbar.polynomial_root(x^3 + 3, CIF((0.6,0.8),(1.1,1.3)))
sage: a
0.7211247851537042? + 1.249024766483407?*I


Then, there is a ready made function to build the number field that contain a given number of elements

sage: number_field_elements_from_algebraics([a.real(), a.imag()], minimal=True)
(Number Field in a with defining polynomial y^6 - 3,
[1/2*a^2, 1/2*a^5],
Ring morphism:
From: Number Field in a with defining polynomial y^6 - 3
To:   Algebraic Real Field
Defn: a |--> 1.200936955176003?)


The output is a triple that consists of a number field, the two elements you are looking for and a morphism to QQbar.

Vincent

more

## Comments

Thanks so much, I got it to work with: QQbar.polynomial_root(number_field.defining_polynomial(), CIF(number_field.gen_embedding())

( 2015-02-20 21:57:32 -0500 )edit

I guess you want to stay within the framework of number fields that Sage offers. What you need is to get the generator of your embedded field F as an algebraic number. You can try to get it as follows:

sage: F = NumberField(x^3+3, 'z', embedding=0.7+1.2j)
sage: F.gen_embedding()
0.7211247851537042? + 1.249024766483407?*I


Unfortunately, this number is not an algebraic number but a kind of infinite sequence of digits, known as lazy expansion, for which you can not easily recover the algebraic number it comes from:

sage: F.gen_embedding().parent()
Complex Lazy Field
sage: QQbar(F.gen_embedding())
TypeError: Illegal initializer for algebraic number


So, we have to look at others methods your (embedded) number field offers. If we have the embedding as morphism from F to the Algebraic Field we would be done. Let us try:

sage: F.embeddings(QQbar)
[
Ring morphism:
From: Number Field in z with defining polynomial x^3 + 3
To:   Algebraic Field
Defn: z |--> -1.442249570307409?,
Ring morphism:
From: Number Field in z with defining polynomial x^3 + 3
To:   Algebraic Field
Defn: z |--> 0.7211247851537042? - 1.249024766483407?*I,
Ring morphism:
From: Number Field in z with defining polynomial x^3 + 3
To:   Algebraic Field
Defn: z |--> 0.7211247851537042? + 1.249024766483407?*I
]


While the documentation F.embeddings? says "If possible, the most natural embedding of self into K is put first in the list.", you can see that this method do not care about the embedding you provided (which should have been considerd as the most natural) since it did not put that embedding first, it just chosed the fanciest one.

There should be a method that is able to select the embedding you provided as a morphism into QQbar !!!

Note that we have:

sage: F.coerce_embedding()
Generic morphism:
From: Number Field in z with defining polynomial x^3 + 3
To:   Complex Lazy Field
Defn: z -> 0.7211247851537042? + 1.249024766483407?*I


But again, it falls into the ComplexLazyField, so it is useless for our purpose.

For me, the general issue with embedded number fields in Sage is that the number field does not care much about the embedding you provided. This issue points a general problem with number fields in Sage: there is no specific class for "embedded number field", the fact that a number field is embedded or not is just a ._embedding attribute within the same class NumberField (while the mathematical objects are really different), so you can define an embedding, but then the number field does not offer additional specific methods for that (in particular, it can not select the correct embedding from within F.embeddings(QQbar), which is a pity).

What you can do is to discover by yourself which embedding into QQbar from the list corresponds to the single embedding into CLF (stands for ComplexLazyField). A trick is to extend the morphism from QQbar to CLF and check for equality:

sage: def my_embedding_as_qqbar(K):
....:     for f in F.embeddings(QQbar):
....:         if f.extend_codomain(CLF ...
more

## Comments

This is insightful, but the other solution is ultimately much shorter.

( 2015-02-20 21:58:34 -0500 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2015-02-13 12:47:13 -0500

Seen: 358 times

Last updated: Feb 15 '15