1

I am new Julia and I am trying to add a multivariate polynomial to a univariate polynomial.

In essence my problem is summed up in the following code:

R = GF(2);
S, z = PolynomialRing(R, z);

a = Array{gfp_poly}(undef, 1, 5);
a = [z*0 z*0 z^1 z^2 z^3];

R = GF(2)
S, (z, x) = PolynomialRing(R, ["z", "x"]);

b = Array{gfp_mpoly}(undef, 1, 5);
b = [z*0 z^1 z^2 z^3 z^4];

c = a + b; 

Now, the polynomial b doesn't depend on the variable x, therefore, an easy fix will be to make b a univariate polynomial as well. However, b needs to be a multivariate polynomial as it is operated on later on in the code with another multivariate polynomial. Unless you can convert a type gfp_poly to a gfp_mpoly I cannot see how I can add two polynomials one of which is a univariate and the other a multivariate. As far I am concerned I do not think this is possible to do.

An alternative would be to make a of type gfp_mpoly, however, a needs to be a univariate as I need to use a to run other Nemo functions such as isirreducible which as far as I have tried is not possible on types gfp_mpoly.

Thanks in advance for the help!

Mors
  • 11
  • 1
  • Please correct `S, z = PolynomialRing(R, z);` to `S, z = PolynomialRing(R, "z");`. Also adding `using Nemo` at top would help readers run this. `S, (z, x) = PolynomialRing(R, ["z", "x"]);` is overwriting the previous `S` and `z` which will be needed later. Finally, to create an array of `gfp_mpoly` you can use the syntax: `b = gfp_mpoly[z*0 z^1 z^2 z^3 z^4]`. These changes will be needed before the actual question can be addressed. – Dan Getz Dec 04 '22 at 18:40

0 Answers0