Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SR through a wrapper class for symbolic equations, inequalities #30234

Open
mkoeppe opened this issue Jul 27, 2020 · 4 comments
Open

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jul 27, 2020

We create a "subring" of the Symbolic "Ring" that only includes value objects without variables (like SymbolicConstantsRing) and has eager evaluation of relational operators.

Compare:

sage: s = SR('x') == 1                                                                                                                                                           
sage: s                                                                                                                                                                          
x == 1
sage: s in SR                                                                                                                                                                    
True

with:

sage: SymbolicValuesRing(SR('x'))
x
sage: SymbolicValuesRing(SR('x') >= 1)
error - cannot convert
sage: SymbolicValuesRing('x') >= 1
error - cannot decide
sage: assume(x >= 2)
sage: SymbolicValuesRing('x') >= 1
True

This could then be used for example with Polyhedron(..., backend='field').

Approach 1 to implement this is to wrap elements of SR in some wrapper class.

Approach 2 is to implement it through refactoring:

  • We refactor the Symbolic Ring so that there is a convenient parent class for symbolic expressions with normal Python comparison semantics instead of creating relations.

  • The magic behavior of comparison operators for SR elements, creating relations, will be implemented in a wrapper class.
    Ideally, this will be unified with the separate implementation of this functionality in sage.numerical.linear_functions.

Here we do Approach 1.

CC: @mjungmath @egourgoulhon @DaveWitteMorris @yuan-zhou

Component: symbolics

Issue created by migration from https://trac.sagemath.org/ticket/30234

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Wrapper class for symbolic equations, inequalities Refactor SR through a wrapper class for symbolic equations, inequalities Nov 2, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

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

No branches or pull requests

1 participant