# Getting the trace polynomial

Dear all,

I am using sagemath to get the trace polynomial from a given reciprocal polynomial of even degree. The process is described nicely on the documentation. I am not allowed to post a link. See below for a concrete example.

However, the algorithm returns a triple $(Q, R, q)$. For further calculations, I need to take out just the polynomial $Q$. Here is an example

pol.<x> = PolynomialRing(Rationals()) sage: u = x^6 +1; u1=u.trace_polynomial()

The algorithm returns $u1=(x^3 - 3*x, 1, 1)$ (in my examples, I know that $R=q=1$ always). How can I get the first component of $u1$?

Edit: Simply take $u1[0]$ as suggested below by another user.

How can we resolve this problem? I am sorry if my question is too trivial. Thank you very much!

Best wishes, Tung

edit retag close merge delete

Sort by » oldest newest most voted

There is a difference between u and u.trace_polynomial(); the former is a polynomial and the latter is a tuple.

It seems that what you want is just u.trace_polynomial()[0].

more

You are right. I am so sorry for this trivial mistake. It works!

( 2021-11-16 16:18:11 +0100 )edit