Skip to content

Fix print of 1 inequality #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading