# Defining ImageSet union #12011

Open
wants to merge 5 commits into
from
+330 −60

None yet

### 3 participants

Member
 This PR has some parts of #11188 . This PR will be useful in simplifying/combining 2 or more ImageSet. E.g. `````` In [45]: img1 = ImageSet(Lambda(n, 3*n), S.Integers) ...: img2 = ImageSet(Lambda(n, 6*n), S.Integers) ...: In [46]: Union(img1, img2) Out[46]: {3⋅n | n ∊ ℤ} In [47]: img1 = ImageSet(Lambda(n, 2 * n * pi - pi / 3), S.Integers) ...: img2 = ImageSet(Lambda(n, 2 * n * pi + 2 * pi / 3), S.Integers) ...: img3 = ImageSet(Lambda(n, 2 * n * pi - 2 * pi / 3), S.Integers) ...: img4 = ImageSet(Lambda(n, 2 * n * pi + pi / 3), S.Integers) ...: img5 = ImageSet(Lambda(n, n * pi - pi / 3), S.Integers) ...: img6 = ImageSet(Lambda(n, n * pi - 2 * pi / 3), S.Integers) ...: In [48]: Union(img1, img2, img3, img4) Out[48]: ⎧ 2⋅π ⎫ ⎧ π ⎫ ⎨n⋅π - ─── | n ∊ ℤ⎬ ∪ ⎨n⋅π - ─ | n ∊ ℤ⎬ ⎩ 3 ⎭ ⎩ 3 ⎭ ``````
added some commits Jan 3, 2017
 Shekharrajak `imageset union is defined` `f415780` Shekharrajak `minor change` `2187570` Shekharrajak `some doctest edited` `16d34f5`
Member
 Some testcases are failing since set can produce different order of imageset next time, when we run.
 Shekharrajak `fixed the bug (using ordered sequence instead of set)` `cb17000`
Member
commented Jan 5, 2017 edited
 I hope I have fixed the issue I mentioned here . That time I used FiniteSet . This time I am using list. Please restart the build (or cross check it in your local system whether it is passing all the time or not (it is done). I have checked in my system more than 5 times for Python version 3.5, 3.3, 2.7)
added this to the SymPy 1.1 milestone Jan 5, 2017
reviewed
 + uni1 = ImageSet(Lambda(n, pi * n / 2 + 2 * pi / 3), S.Integers) + uni2 = ImageSet(Lambda(n, pi * n / 2 + pi / 3), S.Integers) + # One can check the answer using following lines + # for i in range(0, 10):
Member

using multiline comment here would make that more readable i.e

``````'''
'''
``````
Member

Thanks @gxyd , I will do these changes in next commit.

 Shekharrajak `minor change` `0209c78`
Member
 I think, it is good to go.
referenced this pull request Jan 20, 2017
Open