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 <smi...@gmail.com> 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 sy...@googlegroups.com.
I have sympy running under Windows 10-64.
Recently I discovered that the standard installation includes all the sources, and I wonder how easy it would be to recompile one source with - say - a print statement included. I added a print statement, and vaguely hoped that merely altering the source would trigger a recompile of that source file.
I didn't get my printout - either because I had not placed it in the right place, or because it wasn't compiled. Can anyone help?
David
Did you add the print statement to a source file in a standard installation? The compiled files are also part of the standard installation and can usually be modified only by the super user. Running as an ordinary user will not compile the sources. Instead, you should install a copy of the library in a directory where you have all access rights. The sources can be downloaded from https://www.sympy.org/en/download.html.
Thanks for your reply.
Sorry, I should probably have added a bit more information.
In fact I installed python and sympy in a read-write location on my machine: c:\PythonSystem. I also have a copy, so if I were to corrupt the library, I could just copy the whole thing back again to reset it. I noticed that if I generate an exception, the system references those source files, for example:
File
"C:\PythonSystem\lib\site-packages\sympy\combinatorics\partitions.py",
line 233, in RGS
partition = self.partition
Etc etc
Given that, what else do I need to do to compile my modified source?
David
You don't have to do anything. Python compiles .py files automatically.
This is what I originally suspected, and I have now confirmed it by putting a deliberate error in the source file and observing it stumble over that.
Strangely adding a line
print("Testing\n")
(suitably indented)
didn't work - but possibly there are reasons why print doesn't output from within sympy.
Thanks for your help,
David
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/95f2dab1-446c-4196-9363-b51de7ed44e1%40googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/dc79e5a0-a782-42f2-8220-e110191e2b5f%40googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/53fd30ac-04e5-4f07-83dc-a42f67eef1a8%40googlegroups.com.