Ask Your Question

Getting the trace polynomial

asked 2021-11-16 16:08:43 +0200

tungnt gravatar image

updated 2021-11-16 16:17:26 +0200

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-11-16 16:14:25 +0200

rburing gravatar image

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].

edit flag offensive delete link more


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

To the moderator: if you feel that my question is too trivial, please delete it. I am sorry about this.

tungnt gravatar imagetungnt ( 2021-11-16 16:18:11 +0200 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2021-11-16 16:08:43 +0200

Seen: 1,256 times

Last updated: Nov 16 '21