Multivariate polynomial ring with total degree no larger than n

46 views
Skip to first unread message

timaeus

unread,
Mar 12, 2022, 11:14:26 AM3/12/22
to sage-support

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.

  2. I found a link on this site concerning "set-of-polynomial-under-a-certain-degree" (I cannot post it since I am a new user) which suggests a function max_degree for polynomial rings. However, it seems there is no such a 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!

Peter Mueller

unread,
Mar 12, 2022, 5:29:34 PM3/12/22
to sage-support
I would do something like this (example for n=5):
```
n = 5
R = PolynomialRing(QQ, 'x', n)
x0 = R.gen(0) # A shorter alternative is R.0
f = sum((i+1)*x0^i for i in range(n+1)) # sample polynomial
p = 1
for xi in R.gens():
    p *= f.substitute({x0:xi})
    p = sum(coeff*mono for coeff, mono in list(p) if mono.degree() <= n)
``` 

Reply all
Reply to author
Forward
0 new messages