New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify ComplexPlane({x}*{y}) to FiniteSet(x + I*y) #9671

Merged
merged 3 commits into from Jul 22, 2015

Conversation

Projects
None yet
4 participants
@aktech
Copy link
Member

aktech commented Jul 13, 2015

Simplify singleton Element in Complex Plane ComplexPlane({x}*{y}).

fixes #9669

Earlier:

In [6]: ComplexPlane(FiniteSet(x)*FiniteSet(y))
Out[6]: ComplexPlane(Lambda((x, y), x + I*y), {x} x {y})

Now:

In [4]: ComplexPlane(FiniteSet(x)*FiniteSet(y))
Out[4]: {x + I*y}

EDIT TODO

  • Implement this for ProductSet of FiniteSet's of any length.
  • Add Tests

@hargup @flacjacket @jksuom

@aktech aktech added the sets label Jul 13, 2015

obj = ImageSet.__new__(cls, Lambda((x, y), x + I*y), sets)

if (all([_a.is_FiniteSet for _a in sets.args]) and
all([len(_a) == 1 for _a in sets.args])):

This comment has been minimized.

@flacjacket

flacjacket Jul 15, 2015

Member

You don't need the [] here, all() will work fine on a generator, and will make it not have to create a list. You can also combine these with _a.is_FiniteSet and len(_a) == 1 (tho that may not necessarily help performance)

This comment has been minimized.

@flacjacket

flacjacket Jul 15, 2015

Member

You should also check that you have exactly 2 args in sets

@aktech aktech force-pushed the aktech:complex-fs branch from 988de35 to 8fee664 Jul 20, 2015

Simplify ComplexPlane with FiniteSets
Signed-off-by: AMiT Kumar <dtu.amit@gmail.com>
@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 21, 2015

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jul 21, 2015

+1

1 similar comment
@hargup

This comment has been minimized.

Copy link
Member

hargup commented Jul 22, 2015

+1

hargup added a commit that referenced this pull request Jul 22, 2015

Merge pull request #9671 from aktech/complex-fs
Simplify ComplexPlane({x}*{y}) to FiniteSet(x + I*y)

@hargup hargup merged commit 9e6a4da into sympy:master Jul 22, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@aktech aktech deleted the aktech:complex-fs branch Jul 25, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment