From ecb86a5f01b65de47dec543d6b9f12fe2f9ad1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Mon, 2 Sep 2024 11:49:44 +0200 Subject: [PATCH] Add programmatic construction to README --- README.md | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 88e08ec..c9c65a2 100644 --- a/README.md +++ b/README.md @@ -8,24 +8,43 @@ Extension of MultivariatePolynomials to semialgebraic sets, i.e. sets defined by inequalities and equalities between polynomials. The following example shows how to build an [algebraic set/algebraic variety](https://en.wikipedia.org/wiki/Algebraic_variety) ```julia -using TypedPolynomials -@polyvar x y z -# Algebraic variety https://en.wikipedia.org/wiki/Algebraic_variety#/media/File:Elliptic_curve2.png -@set y^2 == x^3 - x -@set x^3 == 2x*y && x^2*y == 2y^2 - x -@set x*y^2 == x*z - y && x*y == z^2 && x == y*z^4 -@set x^4*y^2 == z^5 && x^3*y^3 == 1 && x^2*y^4 == 2z -@set x == z^2 && y == z^3 +julia> using SemialgebraicSets, TypedPolynomials + +julia> @polyvar x y z; + +julia> @set x*y^2 == x*z - y && x*y == z^2 && x == y*z^4 +Algebraic Set defined by 3 equalities + y - x*z + x*y^2 = 0 + -z^2 + x*y = 0 + x - y*z^4 = 0 + +julia> algebraic_set([x*y^2 - x*z - y, x*y - z^2, x - y*z^4]) +Algebraic Set defined by 3 equalities + -y - x*z + x*y^2 = 0 + -z^2 + x*y = 0 + x - y*z^4 = 0 ``` -The following example shows how to build an [basic semialgebraic set](http://www.mit.edu/~parrilo/cdc03_workshop/10_positivstellensatz_2003_12_07_02_screen.pdf) +The following example shows how to build an [basic semialgebraic set](http://www.mit.edu/~parrilo/cdc03_workshop/10_positivstellensatz_2003_12_07_02_screen.pdf). ```julia -using TypedPolynomials -@polyvar x y -@set x^2 + y^2 <= 1 # Euclidean ball -# Cutting the algebraic variety https://en.wikipedia.org/wiki/Algebraic_variety#/media/File:Elliptic_curve2.png -@set y^2 == x^3 - x && x <= 0 -@set y^2 == x^3 - x && x >= 1 +julia> using SemialgebraicSets, TypedPolynomials + +julia> @polyvar x y; + +julia> @set x^2 + y^2 <= 1 # Euclidean ball + +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 + x + y^2 - x^3 = 0 +1 inequalitty + -x ≥ 0 + + +julia> basic_semialgebraic_set(algebraic_set([y^2- x^3 - x]), [-x]) +Basic semialgebraic Set defined by 1 equalitty + -x + y^2 - x^3 = 0 +1 inequalitty + -x ≥ 0 ``` ## Solving systems of algebraic equations