Skip to content

Commit 286ceed

Browse files
authored
Issue 332 (#336)
* bump SpecialFunctions, version number * define abs2 differently; address issue #332
1 parent 115faa5 commit 286ceed

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name = "SymPy"
22
uuid = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"
3-
version = "1.0.16"
3+
version = "1.0.17"
4+
45

56
[deps]
67
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/mathfuns.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
Base.abs(x::SymbolicObject) = sympy.Abs(x)
5-
Base.abs2(x::SymbolicObject) = abs(x)^2
5+
Base.abs2(x::SymbolicObject) = x * conj(x)
66
Base.max(x::Sym, a) = sympy.Max(x, a)
77
Base.min(x::Sym, a) = sympy.Min(x, a)
88

test/tests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,13 @@ end
597597
ex = 3 * sympy.E * x
598598
fn = lambdify(ex)
599599
@test fn(1) 3*exp(1) * 1
600+
601+
## Issue 332 with `abs2`
602+
@vars x real=true
603+
@test abs2(x) == x*x
604+
@vars x
605+
@test abs2(x) == x*conj(x)
606+
600607
end
601608

602609
@testset "generic programming, issue 223" begin

0 commit comments

Comments
 (0)