Ask Your Question

Revision history [back]

Replace coefficient to specific value on multivariate polynomial

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)
print(X)

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