Comments (3)
I don't think there is a direct way so far. Sorry!
from homotopycontinuation.jl.
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.
Here is an example.
julia> @var x y z
(x, y, z)
julia> E = [1 2 3; 0 2 1; 3 5 6; 1 0 2]
4×3 Matrix{Int64}:
1 2 3
0 2 1
3 5 6
1 0 2
julia> c = [5, -3, 2, 3]
4-element Vector{Int64}:
5
-3
2
3
julia> sum(coeff * prod([x,y,z] .^ row) for (row, coeff) in zip(eachrow(E), c))
3*x*z^2 - 3*y^2*z + 5*x*y^2*z^3 + 2*x^3*y^5*z^6
A little bit clumsy but should get the job done
from homotopycontinuation.jl.
Thank you, @saschatimme @PBrdng! I also found another way using Meta
:
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.
from homotopycontinuation.jl.
Related Issues (20)
- e not defined for sqrt() HOT 6
- cache_min_length failing with empty iterator HOT 1
- Seed for mondromy not working as intended
- Symbolic linear system solving not supported by ModelKit HOT 2
- Issues dealing with BigFloat coefficients HOT 6
- find_start_pair failing on some linearly-parametrized square systems HOT 2
- `OP_POW` not defined HOT 5
- Add checkpoints for monodromy_solve
- HC fails to solve sanity check HOT 7
- Strange behaviour of numerical irreducible decomposition HOT 4
- Can't build a system with Unicode symbols in variable names HOT 2
- `Threads.resize_nthreads!` is deprecated HOT 1
- Non-real solution incorrectly certified as real
- Start System Complaints: Incorrect Rank Calculation HOT 2
- What is the best way to approximate trigonometric functions in HC HOT 2
- LaTeX pretty printing breaks for (negative) exponents HOT 2
- sing_accuracy not recognised as endgame parameter HOT 9
- Missing Solutions HOT 8
- Arblib dependencies incompatible with Oscar.jl HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homotopycontinuation.jl.