Skip to content

Commit 4c29aeb

Browse files
committed
export mpoly functionality separately as polynormalize
1 parent b6a7675 commit 4c29aeb

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/simplify.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ function simplify(x, ctx=DefaultCtx();
4747
rules=default_rules(x, ctx),
4848
fixpoint=true,
4949
applyall=true,
50-
mpoly=false,
5150
kwargs...)
52-
if mpoly
53-
x = to_term(to_mpoly(x)...)
54-
end
5551
if fixpoint
5652
SymbolicUtils.fixpoint(rules, x, ctx; applyall=applyall)
5753
else
5854
rules(x, ctx; applyall=applyall, kwargs...)
5955
end
6056
end
6157

58+
function polynormalize(x)
59+
to_term(to_mpoly(x)...)
60+
end
61+
6262

6363
Base.@deprecate simplify(x, rules::RuleSet; kwargs...) simplify(x, rules=rules; kwargs...)
6464

test/nf.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using SymbolicUtils, Test
2+
using SymbolicUtils: polynormalize
23
@testset "polyform" begin
34
@syms a b c d
4-
@test simplify(a * (b + -1 * c) + -1 * (b * a + -1 * c * a), mpoly=true) == 0
5-
@eqtest simplify(sin((a+b)^2)^2; mpoly=true) == sin(a^2+b^2+2*a*b)^2
5+
@test polynormalize(a * (b + -1 * c) + -1 * (b * a + -1 * c * a), mpoly=true) == 0
6+
@eqtest polynormalize(sin((a+b)^2)^2) == sin(a^2+b^2+2*a*b)^2
67
# fixme: can this be made faster?
7-
@test simplify(sin((a+b)^2)^2 + cos((a+b)^2)^2; mpoly=true) == 1
8+
@test simplify(polynormalize(sin((a+b)^2)^2 + cos((a+b)^2)^2)) == 1
89
end

0 commit comments

Comments
 (0)