How to change The Ring of the polynomial in Julia

82 views Asked by At

Main

using AbstractAlgebra
include("./lib.jl"); 
S, (a,b,c) = PolynomialRing(QQ,["a","b","c"])
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)

function that has to change ring of the polynomial


using AbstractAlgebra;

function resultant_system(poly_list, eliminationVar)
    parentRing = parent(poly_list[1])
    # println("parentRing:  ", parentRing, "\n")
    # println("eliminationVar: ", 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("parentVars: ", parentVars)

    X, p = PolynomialRing(QQ, parentVars)
    U, u = PolynomialRing(X, LIST_SIZE, "u")
    V, v = PolynomialRing(U, LIST_SIZE, "v")

    R, a = PolynomialRing(V, string(eliminationVar))
    println("R:", 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

I need to convert Multivariate Polynomial Ring in a, b, c over Rationals to

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

    # 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

0

There are 0 answers