Ask Your Question
0

Creating a polynomial with coefficients in a cyclotomic fields

asked 2024-03-11 06:19:51 +0100

tungnt gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2024-03-11 11:51:25 +0100

rburing gravatar image

In your test_2 the object K1 is the cyclotomic field, not the polynomial ring over it, hence the error.

Probably you meant something like this:

def test_3(p):
    K.<z> = CyclotomicField(p**2)
    R.<x> = PolynomialRing(K)
    v = [E(p)**s for s in srange(0,p)]
    v.reverse()
    F = R(v)
    return F

Example:

sage: test_3(3)
x^2 + z^3*x - z^3 - 1
sage: test_3(3).factor()
(x - 1) * (x + z^3 + 1)
edit flag offensive delete link more

Comments

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

tungnt gravatar imagetungnt ( 2024-03-11 15:03:58 +0100 )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

Stats

Asked: 2024-03-11 06:19:51 +0100

Seen: 211 times

Last updated: Mar 11