Ask Your Question
1

Multivariate polynomial ring with total degree no larger than n

asked 2022-03-11 17:38:44 +0100

timaeus gravatar image

updated 2022-03-12 18:16:02 +0100

slelievre gravatar image

Hello everyone,

I need to compute the product: $f(x_1) f(x_2) ... f(x_n)$, where $f$ is a polynomial of degree $n$, and I do not need the part with total degree larger than $n$. To reduce the computation complexity, I think it would be helpful to construct an $n$-variable multivariate polynomial ring, with terms total degree no larger than $n$. I found the following two possible ways to do this, however, I could not make either of them work for my settings.

  1. Create a multivariate polynomial ring then quotient out every monomial with total degree larger than $n$. However I do not know how to express this ideal.

    Q = PolynomialRing(QQ, n, 'x') 
    x = Q.gens()
    
  2. I found a suggestion to use a function max_degree for polynomial rings at

    However, it seems there is no max_total_degree function for the multivariate case.

I am new to Python, Sage, and this community, so thank you in advance for your helpful suggestions and comments!

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2022-03-12 18:09:31 +0100 )edit
1

To post links as a new user, insert spaces in them. Someone can then fix them.

Example: https ://doc .sagemath .org

slelievre gravatar imageslelievre ( 2022-03-12 18:10:33 +0100 )edit

Thank you very much for fixing my link and your comment!

timaeus gravatar imagetimaeus ( 2022-03-13 01:52:44 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-03-12 22:00:33 +0100

Max Alekseyev gravatar image

updated 2022-03-13 15:59:06 +0100

Ignoring parts with total degree $\geq d$ suggests that power series with precision $d$ are more suitable in this setting:

d = 3
Q = PowerSeriesRing(QQ, 3, 'x', default_prec=d) 
x = [g.add_bigoh(d) for g in Q.gens()]
f = x[0]^4
print( f.add_bigoh(d).polynomial() )
edit flag offensive delete link more

Comments

Thank you for your answer! I tried the following code: Q = PowerSeriesRing(QQ, 3, 'x', default_prec = 3); x = Q.gens(); f = x[0]^2; print(f^3) However I still get x0^6 here instead of an expected 0.

timaeus gravatar imagetimaeus ( 2022-03-13 02:00:57 +0100 )edit

It turns out generators do not inherit default precision, so it needs to be added explicitly. In your example, it would be x = [g.add_bigoh(3) for g in Q.gens()].

Max Alekseyev gravatar imageMax Alekseyev ( 2022-03-13 03:17:18 +0100 )edit

P = PowerSeriesRing(QQ, 3, 'x', default_prec = 3); x = [g.add_bigoh(3) for g in P.gens()]; f=P(x[0]^4); f

The above code still yields x0^4 + O(x0, x1, x2)^6 instead of 0. Also, since I need to convert the product into symmetric polynomials afterwards, the introducing of the big O seems cause more trouble...

timaeus gravatar imagetimaeus ( 2022-03-13 08:20:20 +0100 )edit

The reason is that Sage tries to keep precision as large as possible, and for the 4th power the precision becomes 6. It can be always decreased by .add_bigoh() and the resulting series can be converted into a polynomial via .polynomial() method. I've updated an example in my answer accordingly.

Max Alekseyev gravatar imageMax Alekseyev ( 2022-03-13 15:58:06 +0100 )edit

Thank you very much for your answer! It works fine now. By the way, do you know how to fix this problem under your settings?

g(y) = y^2; g(x[0])

This code used to work when Q is a polynomial ring, but it seems get some trouble when Q is a power series ring.

timaeus gravatar imagetimaeus ( 2022-03-14 16:50:24 +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: 2022-03-11 17:38:44 +0100

Seen: 428 times

Last updated: Mar 13 '22