Skip to content

Commit

Permalink
Fix print of 1 inequality (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat authored Oct 8, 2024
1 parent ecb86a5 commit c386495
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,27 @@ julia> using SemialgebraicSets, TypedPolynomials
julia> @polyvar x y;

julia> @set x^2 + y^2 <= 1 # Euclidean ball
Basic semialgebraic Set defined by no equality
1 inequality
1 - y^2 - x^2 0


julia> basic_semialgebraic_set(FullSpace(), [1 - x^2 - y^2])
Basic semialgebraic Set defined by no equality
1 inequality
1 - y^2 - x^2 0

julia> @set y^2 == x^3 - x && x <= 0 # Cutting the algebraic variety https://en.wikipedia.org/wiki/Algebraic_variety#/media/File:Elliptic_curve2.png
Basic semialgebraic Set defined by 1 equalitty
Basic semialgebraic Set defined by 1 equality
x + y^2 - x^3 = 0
1 inequalitty
1 inequality
-x 0


julia> basic_semialgebraic_set(algebraic_set([y^2- x^3 - x]), [-x])
Basic semialgebraic Set defined by 1 equalitty
Basic semialgebraic Set defined by 1 equality
-x + y^2 - x^3 = 0
1 inequalitty
1 inequality
-x 0
```

Expand Down
2 changes: 1 addition & 1 deletion src/variety.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function _show_els(io::IO, name, n, els, sign)
if n == 0
println(io, "no $(name)y")
elseif n == 1
println(io, "1 $(name)ty")
println(io, "1 $(name)y")
else
println(io, "$n $(name)ies")
end
Expand Down
6 changes: 3 additions & 3 deletions test/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function runtests()
_test_polynomial_API(T, (x, y))
@test sprint(show, T) == "{ (x, y) | x - x^2 = 0, -y + y^2 ≥ 0 }"
@test sprint(show, MIME"text/plain"(), T) ==
"Basic semialgebraic Set defined by 1 equalitty\n x - x^2 = 0\n1 inequalitty\n -y + y^2 ≥ 0\n"
"Basic semialgebraic Set defined by 1 equality\n x - x^2 = 0\n1 inequality\n -y + y^2 ≥ 0\n"
end
end
@testset "Basic with no equality" begin
Expand Down Expand Up @@ -124,10 +124,10 @@ Algebraic Set defined by no equality
_test_polynomial_API(S, (x,))
@test sprint(show, S) == "{ (x) | -1 + x = 0, -x + x^2 ≥ 0 }"
@test sprint(show, MIME"text/plain"(), S) ==
"Basic semialgebraic Set defined by 1 equalitty\n -1 + x = 0\n1 inequalitty\n -x + x^2 ≥ 0\n"
"Basic semialgebraic Set defined by 1 equality\n -1 + x = 0\n1 inequality\n -x + x^2 ≥ 0\n"
@test sprint(show, S.V) == "{ (x) | -1 + x = 0 }"
@test sprint(show, MIME"text/plain"(), S.V) ==
"Algebraic Set defined by 1 equalitty\n -1 + x = 0\n"
"Algebraic Set defined by 1 equality\n -1 + x = 0\n"

S = @set x == 1 && x y && 2 == y
_test_polynomial_API(S, (x, y))
Expand Down

0 comments on commit c386495

Please sign in to comment.