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

function(SetExpr(...)) could be handled better #21618

Open
smichr opened this issue Jun 14, 2021 · 1 comment
Open

function(SetExpr(...)) could be handled better #21618

smichr opened this issue Jun 14, 2021 · 1 comment
Labels

Comments

@smichr
Copy link
Member

smichr commented Jun 14, 2021

from #14251, when SetExpr is the argument of a function it is handled less gracefully than when the argument is AccumBounds:

>>> cos(AccumBounds(-1, 2))
AccumBounds(cos(2), 1)
>>> cos(SetExpr(Interval(-1, 2)))
SetExpr(ImageSet(Lambda(x, cos(x)), Interval(-1, 2)))
>>> var('a b', real=True)
>>> sin(AccumBounds(a, b))
TypeError: input failed to evaluate
>>> sin(SetExpr(Interval(a, b)))
SetExpr(ImageSet(Lambda(x, sin(x)), Interval(a, b)))
@smichr smichr added the sets label Jun 14, 2021
@oscarbenjamin
Copy link
Contributor

I'm not sure how to relate SetExpr and ImageSet because they don't quite do the same thing:

In [28]: s = Interval(0, 1)

In [29]: se = SetExpr(s)

In [30]: se**2 - se
Out[30]: SetExpr([-1, 1])

In [31]: ImageSet(Lambda(x, x**2 - x), s)
Out[31]: 
⎧ 2     │           ⎫
⎨x  - xx ∊ [0, 1]⎬
⎩       │           ⎭

In [32]: ImageSet(Lambda(x, x**2 - x), s).doit()
Out[32]: [-1/4, 0]

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

No branches or pull requests

2 participants