diff --git a/src/operators.jl b/src/operators.jl index 1a7d0cb..fdd2fd4 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -4,7 +4,7 @@ # Defining the specific methods solve this problem and also make # them a lot faster Base.:(^)(x::Variable{V,M}, i::Int) where {V,M} = Monomial{V,M}([x], [i]) -Base.:(^)(x::Monomial{<:Commutative}, i::Int) = Monomial(x.vars, i * x.z) +Base.:(^)(x::Monomial{<:Commutative}, i::Int) = Monomial(copy(x.vars), i * x.z) myminivect(x::T, y::T) where {T} = [x, y] function myminivect(x::S, y::T) where {S,T} diff --git a/test/runtests.jl b/test/runtests.jl index 5551b82..7226e2d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,6 +12,14 @@ using LinearAlgebra @test p(x0 => y0, x1 => y1) == y1 * y0 * y1 end +# https://github.com/JuliaAlgebra/DynamicPolynomials.jl/issues/141 +@testset "Issue #141" begin + @polyvar x + m = x^2 + q = m^2 + @test variables(q) !== variables(m) +end + @testset "Issue #79, Issue #80 and Issue #92" begin @polyvar x[1:2] p1 = x[1] * 0.0 + x[2] * 0