Ask Your Question

Replace coefficient to specific value on multivariate polynomial

asked 2022-05-11 11:17:28 +0200

yt_0429 gravatar image

Hello, I consider a multivariate polynomial ring F_p[t][x,y] with a univariate polynomial ring F_p[t] over a finite field F_p as a coefficient ring (p is prime number).

I want to generate polynomials as follows.

  1. the degree of each coefficient of t is d
  2. the terms of x and y are random except for the constant term
  3. the constant term should have a specific value (e.g., the value obtained by substituting x=t, y=t^2 for the terms other than the constant term). I want to replace constant coefficient to them.

I have done so far. As follows,

p = 31
P.<t> = PolynomialRing(GF(p))
Q.<x,y> = PolynomialRing(P)
X = Q.random_element(degree = 2,terms = 6,choose_degree = True)
while len(list(X)) <= 5:
    X = Q.random_element(degree = 2,terms = 6,choose_degree = True)

But I can't make step 3. What should I do??

edit retag flag offensive close merge delete


I noticed that Step 1 was not done either. How do I specify the order of the coefficient t to be d (d=10, etc.)?

yt_0429 gravatar imageyt_0429 ( 2022-05-12 02:41:57 +0200 )edit

Try X = Q.random_element(2,6,False,10). The thing is that you need to pass d=10 to Q.base().random_element() (i.e. P.random_element()) but you cannot do so as keyword argument since there will be two degree=. So, we have to use positional arguments instead.

Max Alekseyev gravatar imageMax Alekseyev ( 2022-05-12 05:50:58 +0200 )edit

Thank you from the bottom of my heart!!

yt_0429 gravatar imageyt_0429 ( 2022-05-13 06:48:44 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2022-05-11 21:33:17 +0200

Max Alekseyev gravatar image

updated 2022-05-11 21:35:20 +0200

The following should do the job:

X -= X.constant_coefficient()   # removing the current free term
X += X.subs( {x:t, y:t^2} )     # adding the required free term
edit flag offensive delete link more


I appreciate it ! Thank you so much!

yt_0429 gravatar imageyt_0429 ( 2022-05-12 02:36:09 +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: 2022-05-11 11:14:24 +0200

Seen: 151 times

Last updated: May 11 '22