From f79dd28ceb7f24e59a76970f1d718a9022e5a53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Tue, 8 Oct 2024 09:16:11 +0200 Subject: [PATCH] Fix print of 1 inequality --- README.md | 17 +++++++++++++---- src/variety.jl | 2 +- test/macro.jl | 6 +++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c9c65a2..609a523 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/src/variety.jl b/src/variety.jl index 28e685d..c866807 100644 --- a/src/variety.jl +++ b/src/variety.jl @@ -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 diff --git a/test/macro.jl b/test/macro.jl index 6080be9..18fd3e5 100644 --- a/test/macro.jl +++ b/test/macro.jl @@ -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 @@ -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))