Intersection of FiniteSets having symbols

29 views
Skip to first unread message

Harsh Gupta

unread,
Jun 20, 2015, 2:22:46 PM6/20/15
to sy...@googlegroups.com
For the new solveset module we are using the SymPy set object to represent a
solution. So `solveset(x**2 - 1, x)` returns `{-1, 1}` and `solveset(x**2 - a,
x)` returns `{-a, a}` where `a` is a symbol and stands for some parameter and
`{-a, a}` is a FiniteSet object (from the sets module). With such sets sometimes
we encounter operations like the intersection of {a} and {b} where both `a` and
`b` are symbols. The current behavior of SymPy is to return an EmptySet because
`a` is not equal to `b` but in context of solveset it doesn't make sense to
return EmptySet because `a` and `b` are not values but they stand for some value
and it is possible that they will acquire the same value at some later time.
Hence, our plan is to always return an evaluated Intersection object when the
set contains symbols, but this behavior is causing some code to break in the
stats module. The issue can be solved by using python sets instead of FiniteSet
in the code using this functionality and other less preferred option is to add
some flag like `evaluate_symbols` so that people/modules can continue to use the
previous functionality. I want to have an opinion of people using the set
module.


--
Harsh

Aaron Meurer

unread,
Jun 20, 2015, 4:28:02 PM6/20/15
to sy...@googlegroups.com
What exactly fails in the stats module?

My guess is that the sets module will need to be able to have two
modes of operation, one which is very cautious about equality and
doesn't implicitly assume that a != b, and one which is very naive
about equality. The former is more mathematically rigorous, but can
result in unwieldy expressions, which could end up being useless.
Perhaps you are right that the less rigorous case can just be handled
by Python sets, which already consider equality structurally only.

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 post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CADN8iurEUQFmrt9csBZFdkvUymwOjeC83jiejrsuKkBXMUNiVg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

AMiT Kumar

unread,
Jun 20, 2015, 11:10:22 PM6/20/15
to sy...@googlegroups.com
Apart from stats module, few more tests are Failing:
AMiT Kumar
Reply all
Reply to author
Forward
0 new messages