# Polynomial : From AbstractAlgebra to MultivariatePolynomials

Dear all,

I am using AbstractAlgebra.jl to create polynomials in a Julia code. I would like to use HomotopyContinuation.jl package and I should pass to this package polynomial created bt MultivariatePolynomial.jl. I am wondering if there exists an easy way to convert polynomial created by AbstractAlgebra.jl to MutivariatePolynomial.jl.

Thanks very much for all your help.

Here is an example using the example from the README:

``````julia> using AbstractAlgebra, HomotopyContinuation;

julia> QQxy, (x, y) = PolynomialRing(QQ, [:x, :y]);

julia> f = x^2 + 2*y; g = y^2 - 2;

julia> @var _x _y;

julia> vars_ht = [_x, _y];

julia> f_ht = sum(c * prod(vars_ht[i]^e[i] for i in 1:2) for (c, e) in zip(AbstractAlgebra.coefficients(f), exponent_vectors(f)));

julia> f_ht
2*_y + _x^2

julia> g_ht = sum(c * prod(vars_ht[i]^e[i] for i in 1:2) for (c, e) in zip(AbstractAlgebra.coefficients(g), exponent_vectors(g)));

julia> F = System([f_ht, g_ht])
System of length 2
2 variables: _x, _y

2*_y + _x^2
-2 + _y^2
``````
1 Like