title: How to change The Ring of the polynomial in Julia
body: <p>Main</p>
  <pre><code>using AbstractAlgebra
  include(&quot;./lib.jl&quot;); 
  S, (a,b,c) = PolynomialRing(QQ,[&quot;a&quot;,&quot;b&quot;,&quot;c&quot;])
  RR = AbstractAlgebra.RealField
  s1 = S(b^2*a + c*a - 1)
  s2 = S(c*a^2 + -b*a - c^4*a) 
  s3 = S(b*a + a + b)
  
  poly_list = [s1,s2,s3]
  resultant_system(poly_list,a)
  
  </code></pre>
  <p>function that has to change ring of the polynomial</p>
  <pre><code>
  using AbstractAlgebra;
  
  function resultant_system(poly_list, eliminationVar)
      parentRing = parent(poly_list[1])
      # println(&quot;parentRing:  &quot;, parentRing, &quot;\n&quot;)
      # println(&quot;eliminationVar: &quot;, eliminationVar)
      arr = gens(parentRing)
  
      LIST_SIZE = size(poly_list)[1]
  
      parentVars = String[]
      for i = gens(parentRing)
          if i != eliminationVar
              push!(parentVars, string(i))
          end
      end
      println(&quot;parentVars: &quot;, parentVars)
  
      X, p = PolynomialRing(QQ, parentVars)
      U, u = PolynomialRing(X, LIST_SIZE, &quot;u&quot;)
      V, v = PolynomialRing(U, LIST_SIZE, &quot;v&quot;)
  
      R, a = PolynomialRing(V, string(eliminationVar))
      println(&quot;R:&quot;, R)
  
      u_list = gens(U)
      v_list = gens(V)
  
      # poly_list[1] = b^2*a + c*a - 1 BUT
      println(R(poly_list[1]))  # this line not working
      println(R(b^2*a + c*a - 1)) # this line works
  
  end
  
  </code></pre>
  <p>I need to convert <strong>Multivariate Polynomial Ring in a, b, c over Rationals</strong> to</p>
  <blockquote>
  <p>Univariate Polynomial Ring in a over Multivariate Polynomial Ring in v1, v2, v3 over Multivariate Polynomial Ring in u1, u2, u3 over Multivariate Polynomial Ring in b, c over Rationals</p>
  </blockquote>
  <pre><code>    # poly_list[1] = b^2*a + c*a - 1 BUT
      println(R(poly_list[1]))  # this line not working
      println(R(b^2*a + c*a - 1)) # this line works
  
  </code></pre>