Skip to content

Commit 4ce5303

Browse files
authored
Add MacaulayLab to README (#29)
* Add MacaulayLab to README * Specify to install julia package
1 parent 03a854c commit 4ce5303

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

README.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ using TypedPolynomials
1818
@set x == z^2 && y == z^3
1919
```
2020

21+
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)
22+
```julia
23+
using TypedPolynomials
24+
@polyvar x y
25+
@set x^2 + y^2 <= 1 # Euclidean ball
26+
# Cutting the algebraic variety https://en.wikipedia.org/wiki/Algebraic_variety#/media/File:Elliptic_curve2.png
27+
@set y^2 == x^3 - x && x <= 0
28+
@set y^2 == x^3 - x && x >= 1
29+
```
30+
2131
## Solving systems of algebraic equations
2232

2333
Once the algebraic set has been created, you can check whether it is zero-dimensional and if it is the case, you can get the finite number of elements of the set simply by iterating over it, or by using `collect` to transform it into an array containing the solutions.
@@ -32,9 +42,13 @@ The code sample above solves the system of algbraic equations by first
3242
computing a *Gröbner basis* for the system, then the multiplication matrices
3343
and then a Schur decomposition of a random combination of these matrices.
3444
Additionally, SemialgebraicSets defines an interface that can be implemented by
35-
other solvers for these systems.
36-
This allows for instance to solve the systems with
37-
[homotopy continuation](https://www.juliahomotopycontinuation.org/):
45+
other solvers for these systems as shown in the following subsections.
46+
47+
### Solve with [HomotopyContinuation.jl](https://www.juliahomotopycontinuation.org/)
48+
49+
You can solve the system with
50+
[homotopy continuation](https://www.juliahomotopycontinuation.org/)
51+
as follows:
3852
```julia
3953
julia> using HomotopyContinuation
4054

@@ -55,14 +69,27 @@ julia> collect(V)
5569
[-3.0, -2.0]
5670
```
5771

58-
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)
72+
### Solve with [MacaulayLab](http://www.macaulaylab.net/)
73+
74+
You can solve the system with
75+
[MacaulayLab](http://www.macaulaylab.net/) as follows.
76+
First install [MacaulayLab.jl](https://github.com/blegat/MacaulayLab.jl)
77+
and then run the following:
5978
```julia
60-
using TypedPolynomials
61-
@polyvar x y
62-
@set x^2 + y^2 <= 1 # Euclidean ball
63-
# Cutting the algebraic variety https://en.wikipedia.org/wiki/Algebraic_variety#/media/File:Elliptic_curve2.png
64-
@set y^2 == x^3 - x && x <= 0
65-
@set y^2 == x^3 - x && x >= 1
79+
julia> using DynamicPolynomial, MacaulayLab, SemialgebraicSets
80+
81+
julia> solver = MacaulayLab.Solver()
82+
MacaulayLab.Solver()
83+
84+
julia> V = @set x^2 + x == 6 && y == x + 1 solver
85+
Algebraic Set defined by 2 equalities
86+
x^2 + x - 6.0 = 0
87+
-x + y - 1.0 = 0
88+
89+
julia> collect(V)
90+
2-element Vector{Vector{Float64}}:
91+
[2.0000000000000004, 2.999999999999999]
92+
[-3.0000000000000004, -2.0000000000000004]
6693
```
6794

6895
[build-img]: https://github.com/JuliaAlgebra/SemialgebraicSets.jl/workflows/CI/badge.svg?branch=master

0 commit comments

Comments
 (0)