TypedPolynomials.jl
TypedPolynomials.jl copied to clipboard
Conversion error
julia> @polyvar x y
julia> [x^2+x+y y+x; 1 + x x*y+x]
ERROR: MethodError: no method matching Polynomial{Int64,T,V} where V<:AbstractArray{T,1} where T<:(Term{Int64,M} where M<:Monomial)(::Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}})
Stacktrace:
[1] convert(::Type{Polynomial{Int64,T,V} where V<:AbstractArray{T,1} where T<:(Term{Int64,M} where M<:Monomial)}, ::Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}}) at /Users/sascha/.julia/dev/MultivariatePolynomials/src/conversion.jl:5
[2] setindex!(::Array{Polynomial{Int64,T,V} where V<:AbstractArray{T,1} where T<:(Term{Int64,M} where M<:Monomial),1}, ::Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}}, ::Int64) at ./array.jl:769
[3] getindex(::Tuple{Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}},Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}},Polynomial{Int64,Term{Int64,Monomial{(x,),1}},Array{Term{Int64,Monomial{(x,),1}},1}},Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}}}, ::UnitRange{Int64}) at ./range.jl:274
[4] typed_hvcat(::Type{Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}}}, ::Tuple{Int64,Int64}, ::Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}}, ::Vararg{Any,N} where N) at ./abstractarray.jl:1653
[5] hvcat(::Tuple{Int64,Int64}, ::Polynomial{Int64,Term{Int64,Monomial{(x, y),2}},Array{Term{Int64,Monomial{(x, y),2}},1}}, ::Vararg{Any,N} where N) at ./abstractarray.jl:1631
[6] top-level scope at none:0
I think the problem here is the syntax, because the construction of the matrix is character dependent (sensitive to blanks, i don't know the right name for this). I think what you meant to write was
[x^2+x+y y+x; 1+x x*y+x]
(no blanks at 1+x
). This works fine.