-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from JuliaSymbolics/s/expand
polynormalize -> expand
- Loading branch information
Showing
8 changed files
with
43 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
using SymbolicUtils, Test | ||
using SymbolicUtils: polynormalize, Term, symtype | ||
using SymbolicUtils: Term, symtype | ||
@testset "polyform" begin | ||
@syms a b c d | ||
@test polynormalize(a * (b + -1 * c) + -1 * (b * a + -1 * c * a)) == 0 | ||
@eqtest polynormalize(sin(a+b)+sin(c+d)) == sin(a+b) + sin(c+d) | ||
@eqtest simplify(polynormalize(sin((a+b)^2)^2)) == simplify(sin(a^2+2*(b*a)+b^2)^2) | ||
@test simplify(polynormalize(sin((a+b)^2)^2 + cos((a+b)^2)^2)) == 1 | ||
@test expand(a * (b + -1 * c) + -1 * (b * a + -1 * c * a)) == 0 | ||
@eqtest expand(sin(a+b)+sin(c+d)) == sin(a+b) + sin(c+d) | ||
@eqtest simplify(expand(sin((a+b)^2)^2)) == simplify(sin(a^2+2*(b*a)+b^2)^2) | ||
@test simplify(expand(sin((a+b)^2)^2 + cos((a+b)^2)^2)) == 1 | ||
@syms x1::Real f(::Real)::Real | ||
|
||
# issue 193 | ||
@test isequal(polynormalize(f(x1 + 2.0)), f(2.0 + x1)) | ||
@test symtype(polynormalize(f(x1 + 2.0))) == Real | ||
@test isequal(expand(f(x1 + 2.0)), f(2.0 + x1)) | ||
@test symtype(expand(f(x1 + 2.0))) == Real | ||
|
||
# cleanup rules | ||
@test polynormalize(Term{Number}(identity, 0)) == 0 | ||
@test polynormalize(Term{Number}(one, 0)) == 1 | ||
@test polynormalize(Term{Number}(zero, 0)) == 0 | ||
@test polynormalize(identity(a * b) - b * a) == 0 | ||
@test polynormalize(a * b - b * a) == 0 | ||
@test expand(Term{Number}(identity, 0)) == 0 | ||
@test expand(Term{Number}(one, 0)) == 1 | ||
@test expand(Term{Number}(zero, 0)) == 0 | ||
@test expand(identity(a * b) - b * a) == 0 | ||
@test expand(a * b - b * a) == 0 | ||
end |