From bad43ee715b822cf9a1f89b0c3bb3c7ec5a71fed Mon Sep 17 00:00:00 2001 From: Yingbo Ma Date: Wed, 7 Apr 2021 08:16:14 -0400 Subject: [PATCH 1/2] Overload expand --- src/num.jl | 1 + test/overloads.jl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/num.jl b/src/num.jl index bcc18b587..f12f90f18 100644 --- a/src/num.jl +++ b/src/num.jl @@ -72,6 +72,7 @@ function Base.show(io::IO, z::Complex{<:Num}) end SymbolicUtils.simplify(n::Num; kw...) = Num(SymbolicUtils.simplify(value(n); kw...)) +SymbolicUtils.expand(n::Num) = Num(SymbolicUtils.expand(value(n))) """ substitute(expr, s::Dict) diff --git a/test/overloads.jl b/test/overloads.jl index 5fbdb1fa0..2084784ee 100644 --- a/test/overloads.jl +++ b/test/overloads.jl @@ -171,3 +171,6 @@ x = Num.(randn(10)) @test isequal(norm(x, Inf), max(abs(x[1]), abs(x[2]))) @test isequal(norm(x, 1), abs(x[1]) + abs(x[2])) @test isequal(norm(x, 1.2), (abs(x[1])^1.2 + abs(x[2])^1.2)^(1/1.2)) + +@variables x y +@test isequal(expand((x+y)^2), x^2 + y^2 + 2x*y) From abd321707bdf4cf8a99ace22893b9502686eb465 Mon Sep 17 00:00:00 2001 From: Yingbo Ma Date: Wed, 7 Apr 2021 08:16:52 -0400 Subject: [PATCH 2/2] New patch release --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 8a29d61e3..d22702559 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Symbolics" uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7" authors = ["Shashi Gowda "] -version = "0.1.16" +version = "0.1.17" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"