From 808a0431198f493cb39eb7be311b9691af682984 Mon Sep 17 00:00:00 2001 From: ErikQQY <2283984853@qq.com> Date: Sun, 2 Jan 2022 11:09:51 +0800 Subject: [PATCH] Fix TRIG_EXP_RULES Signed-off-by: ErikQQY <2283984853@qq.com> --- src/simplify_rules.jl | 4 ++-- test/rulesets.jl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/simplify_rules.jl b/src/simplify_rules.jl index 74c7b2e84..753dce2c0 100644 --- a/src/simplify_rules.jl +++ b/src/simplify_rules.jl @@ -58,8 +58,8 @@ let TRIG_EXP_RULES = [ @acrule(sin(~x)^2 + cos(~x)^2 => one(~x)) - @acrule(sin(~x)^2 + -1 => cos(~x)^2) - @acrule(cos(~x)^2 + -1 => sin(~x)^2) + @acrule(sin(~x)^2 + -1 => -1*cos(~x)^2) + @acrule(cos(~x)^2 + -1 => -1*sin(~x)^2) @acrule(tan(~x)^2 + -1*sec(~x)^2 => one(~x)) @acrule(tan(~x)^2 + 1 => sec(~x)^2) diff --git a/test/rulesets.jl b/test/rulesets.jl index 4c564d28d..0ae0d4414 100644 --- a/test/rulesets.jl +++ b/test/rulesets.jl @@ -86,6 +86,8 @@ end @eqtest simplify(1 + y + tan(x)^2) == sec(x)^2 + y @eqtest simplify(1 + y + cot(x)^2) == csc(x)^2 + y + @eqtest simplify(cos(x)^2 - 1) == -sin(x)^2 + @eqtest simplify(sin(x)^2 - 1) == -cos(x)^2 end @testset "Exponentials" begin