On Wed, 1 Sept 2021 at 20:06, Charlie Hartman <
[email protected]> 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𝜋}
>

The code that handles this is here:
https://github.com/sympy/sympy/blob/5c2dfe728fd7a93b13a38dd5d547c2acaf4aa8ba/sympy/sets/handlers/intersection.py#L329-L384


> 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:
https://github.com/sympy/sympy/blob/5c2dfe728fd7a93b13a38dd5d547c2acaf4aa8ba/sympy/sets/handlers/intersection.py#L344


Oscar

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxREwkU8f58%3DcCqu09bEgCPsKs8Tycb-%3DA4OrDao-ty7Vw%40mail.gmail.com.

Reply via email to