Skip to content

Commit 5c4e95a

Browse files
update tests to simplify
1 parent b018411 commit 5c4e95a

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ NaNMath = "0.3"
3737
SafeTestsets = "0.0.1"
3838
SpecialFunctions = "0.7, 0.8, 0.9, 0.10"
3939
StaticArrays = "0.10, 0.11, 0.12"
40-
SymbolicUtils = "0.2.1"
40+
SymbolicUtils = "0.3"
4141
TreeViews = "0.3"
4242
UnPack = "0.1"
4343
Unitful = "1.1"

test/derivatives.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using Test
66
@variables x y z
77
@derivatives D'~t D2''~t Dx'~x
88

9-
test_equal(a, b) = @test isequal(simplify_constants(a), simplify_constants(b))
9+
test_equal(a, b) = @test isequal(simplify(a), simplify(b))
1010

1111
@test @macroexpand(@derivatives D'~t D2''~t) == @macroexpand(@derivatives (D'~t), (D2''~t))
1212

@@ -17,12 +17,12 @@ dsin = D(sin(t))
1717
@test isequal(expand_derivatives(dsin), cos(t))
1818

1919
dcsch = D(csch(t))
20-
@test isequal(expand_derivatives(dcsch), simplify_constants(-coth(t) * csch(t)))
20+
@test isequal(expand_derivatives(dcsch), simplify(-coth(t) * csch(t)))
2121

2222
@test isequal(expand_derivatives(D(-7)), 0)
23-
@test isequal(expand_derivatives(D(sin(2t))), simplify_constants(cos(2t) * 2))
24-
@test isequal(expand_derivatives(D2(sin(t))), simplify_constants(-sin(t)))
25-
@test isequal(expand_derivatives(D2(sin(2t))), simplify_constants(-sin(2t) * 4))
23+
@test isequal(expand_derivatives(D(sin(2t))), simplify(cos(2t) * 2))
24+
@test isequal(expand_derivatives(D2(sin(t))), simplify(-sin(t)))
25+
@test isequal(expand_derivatives(D2(sin(2t))), simplify(-sin(2t) * 4))
2626
@test isequal(expand_derivatives(D2(t)), 0)
2727
@test isequal(expand_derivatives(D2(5)), 0)
2828

@@ -32,8 +32,8 @@ dsinsin = D(sin(sin(t)))
3232

3333
d1 = D(sin(t)*t)
3434
d2 = D(sin(t)*cos(t))
35-
@test isequal(expand_derivatives(d1), simplify_constants(t*cos(t)+sin(t)))
36-
@test isequal(expand_derivatives(d2), simplify_constants(cos(t)*cos(t)+(-sin(t))*sin(t)))
35+
@test isequal(expand_derivatives(d1), simplify(t*cos(t)+sin(t)))
36+
@test isequal(expand_derivatives(d2), simplify(cos(t)*cos(t)+(-sin(t))*sin(t)))
3737

3838
eqs = [0 ~ σ*(y-x),
3939
0 ~ x*-z)-y,
@@ -58,12 +58,12 @@ test_equal(jac[3,3], -1β)
5858

5959
@variables x(t) y(t) z(t)
6060

61-
@test isequal(expand_derivatives(D(x * y)), simplify_constants(y*D(x) + x*D(y)))
62-
@test isequal(expand_derivatives(D(x * y)), simplify_constants(D(x)*y + x*D(y)))
61+
@test isequal(expand_derivatives(D(x * y)), simplify(y*D(x) + x*D(y)))
62+
@test isequal(expand_derivatives(D(x * y)), simplify(D(x)*y + x*D(y)))
6363

6464
@test isequal(expand_derivatives(D(2t)), 2)
6565
@test isequal(expand_derivatives(D(2x)), 2D(x))
66-
@test isequal(expand_derivatives(D(x^2)), simplify_constants(2 * x * D(x)))
66+
@test isequal(expand_derivatives(D(x^2)), simplify(2 * x * D(x)))
6767

6868
# n-ary * and +
6969
isequal(ModelingToolkit.derivative(Operation(*, [x, y, z*ρ]), 1), y*(z*ρ))

test/direct.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ModelingToolkit, StaticArrays, LinearAlgebra, SparseArrays
22
using DiffEqBase
33
using Test
44

5-
canonequal(a, b) = isequal(simplify_constants(a), simplify_constants(b))
5+
canonequal(a, b) = isequal(simplify(a), simplify(b))
66

77
# Calculus
88
@parameters t σ ρ β

test/nonlinearsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ModelingToolkit, StaticArrays, LinearAlgebra
22
using DiffEqBase
33
using Test
44

5-
canonequal(a, b) = isequal(simplify_constants(a), simplify_constants(b))
5+
canonequal(a, b) = isequal(simplify(a), simplify(b))
66

77
# Define some variables
88
@parameters t σ ρ β

test/simplify.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ using Test
55
@variables x(t) y(t) z(t)
66

77
null_op = 0*t
8-
@test isequal(simplify_constants(null_op), 0)
8+
@test isequal(simplify(null_op), 0)
99

1010
one_op = 1*t
11-
@test isequal(simplify_constants(one_op), t)
11+
@test isequal(simplify(one_op), t)
1212

1313
identity_op = Operation(identity,[x])
14-
@test isequal(simplify_constants(identity_op), x)
14+
@test isequal(simplify(identity_op), x)
1515

1616
minus_op = -x
17-
@test isequal(simplify_constants(minus_op), -x)
18-
simplify_constants(minus_op)
17+
@test isequal(simplify(minus_op), -x)
18+
simplify(minus_op)
1919

2020
@variables x
2121

2222
@test simplified_expr(expand_derivatives(Differential(x)((x-2)^2))) == :(2 * (-2 + x))
2323
@test simplified_expr(expand_derivatives(Differential(x)((x-2)^3))) == :(3 * (-2 + x)^2)
24-
@test simplified_expr(simplify_constants(x+2+3)) == :(5 + x)
24+
@test simplified_expr(simplify(x+2+3)) == :(5 + x)
2525

2626
d1 = Differential(x)((-2 + x)^2)
2727
d2 = Differential(x)(d1)
2828
d3 = Differential(x)(d2)
2929

3030
@test simplified_expr(expand_derivatives(d3)) == :(0)
31-
@test simplified_expr(simplify_constants(x^0)) == :(1)
31+
@test simplified_expr(simplify(x^0)) == :(1)

0 commit comments

Comments
 (0)