Currently it returns NotImplemented. Were you thinking EmptySet returns (oo, -oo) for (inf, sup)?
In any case, it is not only inf and sup that are problems for a symbolic range. The problem of how to represent a slice or indexed element of the range is also present, e.g. `Range(x,y,z)[0]` is not `x` unless the range is not empty...and if it is empty then accessing `[0]` would generate an error. On Tuesday, August 27, 2019 at 10:56:21 AM UTC-5, Aaron Meurer wrote: > > I think it's reasonable to return the result. I noticed that > Interval.inf just returns the lower limit, even though Interval can > also technically return an empty set. Actually, the infimum of the > empty set is infinity, not nan, so if that's the concern, we can > include that in the Piecewise result. > > Aaron Meurer > > On Mon, Aug 26, 2019 at 6:29 PM Chris Smith <[email protected] > <javascript:>> wrote: > > > > Ok, that is a detail that can be changed. But the bigger question is > whether we want such an expression to be returned or if we just want to > forbid it and raise an error if a non-Piecewise result cannot be returned. > > > > On Monday, August 26, 2019 at 4:22:13 PM UTC-5, Aaron Meurer wrote: > >> > >> I would structure the Piecewise so that there is no True (otherwise) > >> condition, and the empty set cases fall under that. I think Piecewise > >> already gives nan in such cases. > >> > >> This is also somewhat related to > https://github.com/sympy/sympy/issues/16362. > >> > >> Aaron Meurer > >> > >> On Mon, Aug 26, 2019 at 1:57 PM Chris Smith <[email protected]> wrote: > >> > > >> > In this PR `Range` has been modified to accept symbolic start, stop > and step values, e.g. `Range(x, y, z)`. One of the decisions that needs to > be made is whether such Ranges should return the symbolic logical statement > corresponding to a given attribute or not. > >> > > >> > e.g. the piecewise-folded version of `Range(x, y, z).inf` is > >> > > >> > Piecewise( > >> > (nan, ceiling((-x + y)/z) <= 0), > >> > (x, z > 0), > >> > (x + z*ceiling((-x + y)/z) - z, Ne(x, x + 1)), > >> > (y - z, True)) > >> > > >> > The problem is that the nan result is really not the inf...it is used > to indicate that inf is not defined under conditions that would lead to an > EmptySet, e.g. x=z=1,y=0. Is this of any value or should Range with symbols > just raise a ValueError if a property cannot be given as a simple > expression? > >> > > >> > /c > >> > > >> > -- > >> > 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/6dc89b8f-cf15-4d9e-861c-1ad267df7955%40googlegroups.com. > > > > > > -- > > 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] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/95f2dab1-446c-4196-9363-b51de7ed44e1%40googlegroups.com. > > > -- 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/dc79e5a0-a782-42f2-8220-e110191e2b5f%40googlegroups.com.
