-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ConditionSet object not iterable #21258
Comments
|
But you cannot construct |
It would be possible to add an
Ideally there would be a way to simplify this |
I see. That is a slick workaround but I could see it totally break down for cases where the call to I tried |
That's not a slick workaround. That's what In [11]: ConditionSet(x, x<y, {1, 2, 3})
Out[11]: {x │ x ∊ {1, 2, 3} ∧ (x < y)} There are not many functions for simplifying sets yet. |
I posted this comment at SO:
>>> c = ConditionSet(x, x < 7, S.Naturals)
>>> solveset(c.args[1], c.args[0], domain=S.Reals).intersection(c.args[-1])
Range(1, 7, 1)
>>> next(iter(_))
1 In theory you should be able to set domain=c.args[-1] but the solver does not handle such sets well, yet. |
This is fixed in the most up to date master. |
I would like to generate a simple set based on a condition to mimic set builder notation, and then enumerate its contents. I tried the following based on an example in the docs:
When I run this I get an error:
Why is it that I cannot enumerate the
ConditionSet
object? It has finite contents so I would assume this should be possible?Thanks
The text was updated successfully, but these errors were encountered: