Polynomial of roots of polynomial over the primitive element

48 views
Skip to first unread message

Pedro Vinícius Ferreira Baptista

unread,
Nov 19, 2019, 1:35:24 AM11/19/19
to sage-support
Given an irreducible polynomial P from Q[x] I want to find the primitive element A of the extension field defined by it. 
Moreover I want to know how to write the roots of P in terms of A(per example, the coefficients of the polynomial of powers of A). 
Finally I want to find the dimension of the vectors space of the extension field of the roots of P.
For example, if the roots are sqrt(2) and -sqrt(2) I can write one in terms of the other with rational coefficients(they are rational dependent). So they have dimension 1, in some sense.

One such way of starting this is by making the following:

P = some irreducible polynomial on variable x
K.<a> = NumberField(P)
f = (a).coordinates_in_terms_of_powers()

rts = P.roots(ring=QQbar)#need the QQbar as some without this some roots are not returned
for r in rts:
     coeff = f(r[0])
     #do something with it

So my idea was using this f to get the coefficients of the polynomial in A of the roots of P. But when I do the above I get the following error:
File "sage/rings/number_field/number_field_element.pyx", line 5341, in sage.rings.number_field.number_field_element.CoordinateFunction.__call__ (build/cythonized/sage/rings/number_field/number_field_element.cpp:43366) raise TypeError("Cannot coerce element into this number field") TypeError: Cannot coerce element into this number field
As I saw r[0]'s parent is a Algebraic Field. There is any way of casting or coercing this field into the number field in order to get the coefficients? Because when I write a "number" M in terms of a and call f(M) it works as expected. If not, is there any other way of getting this coefficients? Any work around from number field that gives me these coefficients in terms of the primitive element from the polynomial that generates it? Or is there another approach to this using vectors spaces or modules? Because in the end I'll also need the dimension as said before.

Brent W. Baccala

unread,
Jan 2, 2020, 11:47:44 AM1/2/20
to sage-support
On Tuesday, November 19, 2019 at 1:35:24 AM UTC-5, Pedro Vinícius Ferreira Baptista wrote:
Given an irreducible polynomial P from Q[x] I want to find the primitive element A of the extension field defined by it. 
Moreover I want to know how to write the roots of P in terms of A(per example, the coefficients of the polynomial of powers of A). 

The extension field defined by the polynomial might not be able to factor the polynomial completely, so you might not be able to write the roots of P in terms of A.

Probably what you want is a splitting field for the polynomial.
 
Finally I want to find the dimension of the vectors space of the extension field of the roots of P.

Sounds like a splitting field.  The dimension of the extension field by P would just be the degree of P.  You want the dimension of the splitting field, right?

Here's how I'd do it:

sage: R.<x> = QQ[]
sage
: P = irreducible polynomial in x
sage
: A = P.splitting_field('a')
sage
: RA = PolynomialRing(A, 'x')
sage
: RA(P).factor()


The degree of A's defining polynomial is the dimension of the splitting field as a vector space over QQ.

The last step (factor) gives the roots of the polynomial in terms of the generator 'a'.

P.S. Sorry for the late response.  I don't read this group very often.

Pedro Vinícius Ferreira Baptista

unread,
Feb 20, 2020, 12:14:33 PM2/20/20
to sage-support
Yes I wanted the splitting field. I didn't know exactly the terminology of all this things as I'm still learning most of it.

One more question. Would you happen to know any source that I can look into it to see how or at least the vague idea of how the splitting field and the factors are calculated given the polynomial? Not necessarily the algorithm into its full details but at least the general idea. Mainly I'm more interested into the complexity of it working if it's bounded to some approximation of the factors or it's determined in some way. Thank you for the answer anyways. It was very helpful and I'm sorry for the late reply as after I've found it and your answer I went to look more into these things and forgot to answer.
Reply all
Reply to author
Forward
0 new messages