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

Merge in a more restrictive constraint #177

Open
himito opened this issue Aug 25, 2022 · 4 comments
Open

Merge in a more restrictive constraint #177

himito opened this issue Aug 25, 2022 · 4 comments

Comments

@himito
Copy link

himito commented Aug 25, 2022

Hi,

Firstly, thank you for developing this useful library :)
I would like to know if it's possible to compute a more restrictive constraint from a set of constraints. I mean

> f(*['x0 > 5', 'x0 > 7', 'y0 < 4', 'y0 == 1'])
('x0 > 7', 'y0 == 1')

Thank you in advance.

Cheers,
Jaime

@mmckerns
Copy link
Member

Yeah, merge is supposed to do something like this... but is currently limited to exact matches.

>>> import mystic as my
>>> my.symbolic.merge(*['x < 7', 'x > 7'])
('x != 7',)
>>> my.symbolic.merge(*['x > 5', 'x > 7'])  # currently doesn't reduce
('x > 5', 'x > 7')

It feels like merge should reduce the latter case as well. So, I'll take your question as a feature request.

@himito
Copy link
Author

himito commented Aug 25, 2022

Thank you @mmckerns

@mmckerns
Copy link
Member

This applies to condense as well... as noted in the current source code:

#FIXME: should be better, currently only condenses exact matches
def condense(*equations, **kwds):

@mmckerns
Copy link
Member

mmckerns commented Aug 25, 2022

Note to self: It looks like sympy has improved their inequality solvers since I implemented much of the symbolic module... so maybe I can leverage sympy.solvers.inequalities.reduce_inequalities and other recent tools in https://docs.sympy.org/latest/modules/solvers/inequalities.html.

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

2 participants