# 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.

- the degree of each coefficient of t is d
- the terms of x and y are random except for the constant term
- 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??

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.)?

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.Thank you from the bottom of my heart!!