-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting from Nemo.fmpq_mpoly to HomotopyContinuation.Expression #520
Comments
I don't think there is a direct way so far. Sorry! |
There seems to be a way to extract the exponent vectors and coefficient of the polynomial (see https://nemocas.github.io/AbstractAlgebra.jl/stable/mpolynomial/#Basic-manipulation). If you have the exponents and the coefficients in Matrix and vector form you can rebuild the polynomial.
A little bit clumsy but should get the job done |
Thank you, @saschatimme @PBrdng! I also found another way using function nemo2hc(expr_tree::Union{Expr,Symbol})
#traverse expr_tree
if typeof(expr_tree) == Symbol
return HomotopyContinuation.variables(expr_tree)[1]
end
if typeof(expr_tree) == Expr
if expr_tree.head == :call
if expr_tree.args[1] in [:+, :-, :*, :/, :^]
return reduce(eval(expr_tree.args[1]), map(nemo2hc, expr_tree.args[2:end]))
end
end
end
end called as nemo2hc(Meta.parse(string(poly))) I wonder which way will be faster. |
I have an array of polynomials which are obtained through Nemo CAS. Is there a way to convert them into a
HomotopyContinuation.Expression
type so that I can find roots of the polynomial system? I've tried a few different things but no luck so far.Thanks.
The text was updated successfully, but these errors were encountered: