Ask Your Question

tungnt's profile - activity

2025-05-31 06:59:07 +0100 received badge  Notable Question (source)
2025-05-31 06:59:07 +0100 received badge  Popular Question (source)
2025-03-08 23:14:00 +0100 received badge  Popular Question (source)
2025-03-08 23:14:00 +0100 received badge  Notable Question (source)
2025-01-31 18:49:17 +0100 received badge  Commentator
2025-01-31 18:49:17 +0100 commented answer Iterate over a finite quotient of a multivariate polynomial ring

I have a question related to this (and that is why I responded to this comment instead of creating a new thread). My u

2025-01-26 22:36:18 +0100 marked best answer Iterate over a finite quotient of a multivariate polynomial ring

Hi everyone

I am trying to work with finite rings. In Sagemath, I learned that we could create a finite quotient of a multivariate polynomial ring with the following syntax

S = PolynomialRing(GF(2), 'x, y')
x,y = S.gens()
I = S.ideal([x**2, y**2])
R = S.quotient(I, names=S.variable_names())
print(R)

This works fine. The problem is that I can't iterate through this ring (I guess Sagemath does not automatically know that the ring is finite). A similar question is posted here but only for quotients of univariate polynomial rings.

https://ask.sagemath.org/question/651...

I tried to imitate the method there but have not been able to figure it out. I would love to hear your expertise on this. Additionally, I would love to hear if there is a built-in library in Sagemath for finite rings.

Thank you.

Tung

2025-01-26 22:30:48 +0100 commented answer Iterate over a finite quotient of a multivariate polynomial ring

Thank you very much. You always came to the rescue of my questions! I am working on gcd-graphs. To define this graph, I

2025-01-26 16:36:53 +0100 received badge  Nice Question (source)
2025-01-25 18:15:48 +0100 received badge  Famous Question (source)
2025-01-25 18:14:32 +0100 asked a question Iterate over a finite quotient of a multivariate polynomial ring

Iterate over a finite quotient of a multivariate polynomial ring Hi everyone I am trying to work with finite rings. In

2025-01-10 00:21:19 +0100 received badge  Notable Question (source)
2025-01-10 00:21:19 +0100 received badge  Popular Question (source)
2024-06-21 14:58:13 +0100 received badge  Notable Question (source)
2024-06-21 14:58:13 +0100 received badge  Famous Question (source)
2024-06-21 14:58:13 +0100 received badge  Popular Question (source)
2024-03-13 04:31:05 +0100 received badge  Enthusiast
2024-03-11 15:03:58 +0100 commented answer Creating a polynomial with coefficients in a cyclotomic fields

That makes sense. Very simple and elegant. Thank you!

2024-03-11 15:03:28 +0100 marked best answer Creating a polynomial with coefficients in a cyclotomic fields

Hi everyone

I am trying to create a polynomial from a list of its coefficients. In the past, I have done so when the coefficients are all integers (or they belong to a fixed number field). Typically, that would require me to declare the coefficient field at the beginning. The syntax would look like this

R.<x> = PolynomialRing(QQ)

def test(p):
    v = srange(1,p)
    v.reverse()
    F = R(v)
    return F

After that, I can create $F$ and do some calculations such as factoring $F$ over $\mathbb{Q}$.

My new problem is that I want to create a polynomial with coefficients in (varying) cyclotomic field. I tried the following code but it did not work (it will work if I use the coefficient field as $\overline{\mathbb{Q}}$. However, I won't be able to do factorization over the relevant cyclotomic field).

def test_2(p):
    K1.<x> = CyclotomicField(p**2)
    v = [E(p)**s for s in srange(0,p)]
    v.reverse()
    F = K1(v)
    return F

I appreciate any advice and suggestions.

Thank you for your help.

Best wishes, Tung

2024-03-11 06:19:51 +0100 asked a question Creating a polynomial with coefficients in a cyclotomic fields

Creating a polynomial with coefficients in a cyclotomic fields Hi everyone I am trying to create a polynomial from a l

2023-08-22 08:07:02 +0100 marked best answer Reduction mod p of a polynomial

Hi everyone,

I have a question about the factorization of a polynomial modulo a prime ideal that I would like to help with.

Specifically, let $K$ be a number field (for my problem, we can assume that $K=\mathbb{Q}[i]$ or $K=\mathbb{Q}[\omega]$). I have a polynomial $f$ in $O_K[x]$ and a prime ideal $\mathfrak{p}$ in $O_K$ and I want to compute the factorization of $f$ over $O_K/\mathfrak{p}$.

When $K=\mathbb{Q}$, I use the following built-in function.

f=f.change_ring(GF(p))
f.factor()

I wonder whether we can do the same for a general number field.

Thank you for your help.

-Tung

2023-08-21 22:26:54 +0100 received badge  Nice Answer (source)
2023-08-21 00:53:47 +0100 received badge  Self-Learner (source)
2023-08-21 00:53:47 +0100 received badge  Teacher (source)
2023-08-21 00:02:38 +0100 answered a question Reduction mod p of a polynomial

My collaborator finally figured out how to do this. For your interest, here is how we do it. Let K be the number field,

2023-08-18 21:28:53 +0100 received badge  Notable Question (source)
2023-08-18 21:26:34 +0100 asked a question Reduction mod p of a polynomial

Reduction mod p of a polynomial Hi everyone, I have a question about the factorization of a polynomial modulo a prime

2023-05-27 11:59:28 +0100 received badge  Notable Question (source)
2023-01-22 20:55:37 +0100 received badge  Popular Question (source)
2023-01-22 20:55:34 +0100 received badge  Popular Question (source)
2022-07-08 17:29:41 +0100 commented answer Evaluating a polynomial at root of unity over finite fields

Thank you for your answer! I like this approach as it allows us to see the coefficients of $w^m$. My original goal is t

2022-07-08 17:27:15 +0100 commented answer Evaluating a polynomial at root of unity over finite fields

Thank you very much for your answer!

2022-07-08 06:19:31 +0100 edited question Evaluating a polynomial at root of unity over finite fields

Evaluating a polynomial at root of unity over finite fields Hi everyone! I need to do some simulations for a project th

2022-07-08 06:14:32 +0100 asked a question Evaluating a polynomial at root of unity over finite fields

Evaluating a polynomial at root of unity over finite fields Hi everyone! I need to do some simulations for a project th

2022-03-16 19:34:15 +0100 received badge  Good Question (source)
2022-03-16 15:40:32 +0100 edited answer How is "is_irreducible" function implemented in SAGE

Thank you very much for your detailed answer. Let me provide a more precise description of the problem that I am worki

2022-03-16 15:40:04 +0100 answered a question How is "is_irreducible" function implemented in SAGE

Thank you very much for your detailed answer. Let me provide a more precise description of the problem that I am worki

2022-03-16 14:54:25 +0100 marked best answer How is "is_irreducible" function implemented in SAGE

Dear community,

Suppose I have a polynomial $g$ over a finite field $\mathbb{F}_q[x]$. Then we can check whether $g$ is irreducible by using the following command

g.is_irreducible()

I did not know about this method until recently. Previously, I just factorized g and counted the number of factors. If this number is 1, then g is irreducible. I compared the running time of my method and the above built-in method. I learned that the latter method is much faster (which makes sense). That leads me to wonder whether which method is used to implement is_irreducible. For example, some search on the internet suggests that Rabin's algorithm is a popular one. Is it true that Rabin's algorithm is implemented on Sage? For the record, I am using the paid version of Cocalc.

Thank you for your consideration!

Best wishes, Tung

2022-03-16 11:28:18 +0100 received badge  Nice Question (source)
2022-03-16 06:16:40 +0100 edited question How is "is_irreducible" function implemented in SAGE

How is "is_irreducible" function implemented in SAGE Dear community, Suppose I have a polynomial $g$ over a finite fie

2022-03-16 06:16:03 +0100 asked a question How is "is_irreducible" function implemented in SAGE

How is "is_irreducible" function implemented in SAGE Dear community, Suppose I have a polynomial $g$ over a finite fie

2022-01-13 02:30:35 +0100 marked best answer 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

2022-01-12 23:51:39 +0100 marked best answer G-circulant matrices

Dear the community,

I wonder whether there is a built-in library/function for $G$-circulant matrices in SAGE? Here $G$ is a group and a matrix $A$ is called $G$-circulant if $A$ has the form $A=(a_{ \tau^{-1} \sigma})_{\tau, \sigma \in G}$. Please see [1] for further details.

When $G=\mathbb{Z}/n$, SAGE has a built-in library/function. Namely, given a vector $v$ of length $n$, we can generate a circulant matrix with the first row equal to $v$ using the following code

matrix.circulant(v)

Thank you for your help!

[1] Kanemitsu, Shigeru, and Michel Waldschmidt. "Matrices of finite abelian groups, finite Fourier transform and codes, Proc. 6th China-Japan Sem. Number Theory, World Sci. London-Singapore-New Jersey (2013): 90-106.