Skip to content

Commit d6a527e

Browse files
committed
Fix similarterm with Pow
1 parent 0cb62c0 commit d6a527e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ function similarterm(p::NumericTerm, f, args, T=nothing; metadata=nothing)
954954
elseif f == (*)
955955
Mul(T, makemul(1, args...)...; metadata=metadata)
956956
elseif f == (^) && length(args) == 2
957-
Pow{T, typeof.(args)...}(args...; metadata=metadata)
957+
Pow{T}(makepow(args...)...; metadata=metadata)
958958
else
959959
Term{T}(f, args; metadata=metadata)
960960
end

test/basics.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ end
166166
@test repr((-1)^a) == "(-1)^a"
167167
end
168168

169-
@testset "similarterm with Add" begin
169+
@testset "similarterm" begin
170170
@syms a b c
171171
@test isequal(SymbolicUtils.similarterm((b + c), +, [a, (b+c)]).dict, Dict(a=>1,b=>1,c=>1))
172+
@test isequal(SymbolicUtils.similarterm(b^2, ^, [b^2, 1//2]), b)
172173
end
173174

174175
toterm(t) = Term{symtype(t)}(operation(t), arguments(t))

0 commit comments

Comments
 (0)