Skip to content

Commit

Permalink
Add programmatic construction to README
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Sep 2, 2024
1 parent 951fa3e commit ecb86a5
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ecb86a5

Please sign in to comment.