when do imagesets and intersections resolve to finite sets?

19 views
Skip to first unread message

Charlie Hartman

unread,
Sep 1, 2021, 3:06:54β€―PM9/1/21
to sympy
When do image sets resolve to finite sets when intersected with an interval? For example:

I'm seeing that this looks great:

solveset(sin(x),domain = Reals).intersect(Interval(2,50))
{πœ‹,2πœ‹,3πœ‹,4πœ‹,5πœ‹,6πœ‹,7πœ‹,8πœ‹,9πœ‹,10πœ‹,11πœ‹,12πœ‹,13πœ‹,14πœ‹,15πœ‹}
Β 
but

solveset(sin(sqrt(x)),domain = Reals).intersect(Interval(2,50))
[2,50]∩{π‘₯2|π‘₯∈[0,∞)∩{π‘›πœ‹|π‘›βˆˆβ„€}}

or

solveset(sin(sqrt(x)),domain = Reals).intersect(Interval(2,5))
[2,5]∩{π‘₯2|π‘₯∈[0,∞)∩{π‘›πœ‹|π‘›βˆˆβ„€}}

Don't resolve to finite set. I'm looking at the source for imageset but I can't figure out why these don't resolve. Any direction on how this works would be much appreciated!!



Oscar Benjamin

unread,
Sep 1, 2021, 3:30:20β€―PM9/1/21
to sympy
On Wed, 1 Sept 2021 at 20:06, Charlie Hartman <charlesmic...@gmail.com> wrote:
When do image sets resolve to finite sets when intersected with an interval? For example:

I'm seeing that this looks great:

solveset(sin(x),domain = Reals).intersect(Interval(2,50))
{πœ‹,2πœ‹,3πœ‹,4πœ‹,5πœ‹,6πœ‹,7πœ‹,8πœ‹,9πœ‹,10πœ‹,11πœ‹,12πœ‹,13πœ‹,14πœ‹,15πœ‹}

Β 
but

solveset(sin(sqrt(x)),domain = Reals).intersect(Interval(2,50))
[2,50]∩{π‘₯2|π‘₯∈[0,∞)∩{π‘›πœ‹|π‘›βˆˆβ„€}}

In this case it is the inner intersection that does not evaluate and that has the intersection of an infinite interval with an infinite imageset. The inverter for the sup returns empty set because the answer is oo but that isn't considered to be part of the reals:
Β 

Oscar

Aaron Meurer

unread,
Sep 1, 2021, 4:15:59β€―PM9/1/21
to sympy
I think there's a few things that could be done here:

- Make top-level intersection work by inverting the function in the
image set. This needs to be done carefully, however.
- Make the inner intersection resolve to {n*pi | n in Z+}
- From there, make the image set of an image set resolve to a single imageset.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxREwkU8f58%3DcCqu09bEgCPsKs8Tycb-%3DA4OrDao-ty7Vw%40mail.gmail.com.

Oscar Benjamin

unread,
Sep 1, 2021, 4:21:49β€―PM9/1/21
to sympy
On Wed, 1 Sept 2021 at 21:16, Aaron Meurer <asme...@gmail.com> wrote:
I think there's a few things that could be done here:

- Make top-level intersection work by inverting the function in the
image set. This needs to be done carefully, however.
- Make the inner intersection resolve to {n*pi | n in Z+}
- From there, make the image set of an image set resolve to a single imageset.

It would be good to have a proper way of representing integer intervals as well:

Charlie Hartman

unread,
Sep 3, 2021, 6:54:10β€―AM9/3/21
to sympy
Good stuff, this was enough for me to put together a little ad-hoc program for my purposes. Thanks both!
Reply all
Reply to author
Forward
0 new messages