Skip to content

Variables of the set #7

Description

@blegat

The variables on which a semialgebraic set is currently not defined.
We should add a field containing the ordered list of variables that is by default the union of the variables of all the polynomials defining the set but which can be set to something else.

Current behavior:

julia> using SemialgebraicSets

julia> using DynamicPolynomials

julia> @polyvar x y
(x, y)

julia> S = @set x >= 0 && y >= 0;

julia> variables(S)
ERROR: MethodError: no method matching variables(::BasicSemialgebraicSet{Float64,Polynomial{true,Float64},AlgebraicSet{Float64,Polynomial{true,Float64},Buchberger,SemialgebraicSets.SolverUsingMultiplicationMatrices{SemialgebraicSets.GröbnerBasisMultiplicationMatricesAlgorithm,ReorderedSchurMultiplicationMatricesSolver{Int64,Random.MersenneTwister}}}})
Closest candidates are:
  variables(::SemialgebraicSets.PolynomialIdeal) at /home/blegat/.julia/packages/SemialgebraicSets/64a8D/src/ideal.jl:32
  variables(::Union{AbstractArray{#s26,N} where N where #s26<:(Union{Monomial{C}, PolyVar{C}, Polynomial{C,T} where T, Term{C,T} where T} where C), Union{Monomial{C}, PolyVar{C}, Polynomial{C,T} where T, Term{C,T} where T} where C}) at /home/blegat/.julia/dev/DynamicPolynomials/src/DynamicPolynomials.jl:33
Stacktrace:
 [1] top-level scope at none:0

julia> nvariables(S)
ERROR: MethodError: no method matching nvariables(::BasicSemialgebraicSet{Float64,Polynomial{true,Float64},AlgebraicSet{Float64,Polynomial{true,Float64},Buchberger,SemialgebraicSets.SolverUsingMultiplicationMatrices{SemialgebraicSets.GröbnerBasisMultiplicationMatricesAlgorithm,ReorderedSchurMultiplicationMatricesSolver{Int64,Random.MersenneTwister}}}})
Closest candidates are:
  nvariables(::Union{AbstractArray{#s26,N} where N where #s26<:(Union{Monomial{C}, PolyVar{C}, Polynomial{C,T} where T, Term{C,T} where T} where C), Union{Monomial{C}, PolyVar{C}, Polynomial{C,T} where T, Term{C,T} where T} where C}) at /home/blegat/.julia/dev/DynamicPolynomials/src/DynamicPolynomials.jl:34
  nvariables(::Union{AbstractVariable, Type{#s13} where #s13<:AbstractVariable}) at /home/blegat/.julia/dev/MultivariatePolynomials/src/monomial.jl:38
Stacktrace:
 [1] top-level scope at none:0

julia> variables(S.p)
2-element Array{PolyVar{true},1}:
 x
 y

julia> S.variables
ERROR: type BasicSemialgebraicSet has no field variables

Desired behavior:

julia> using SemialgebraicSets

julia> using DynamicPolynomials

julia> @polyvar x y
(x, y)

julia> S = @set x >= 0 && y >= 0;

julia> variables(S)
2-element Array{PolyVar{true},1}:
 x
 y

julia> nvariables(S)
2

cc @tweisser

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions