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

Equate S.Complexes with ComplexPlane(S.Reals*S.Reals) #9666

Merged
merged 3 commits into from Jul 17, 2015

Conversation

Projects
None yet
3 participants
@aktech
Copy link
Member

aktech commented Jul 13, 2015

It works now:

In [3]: S.Complex == ComplexPlane(S.Reals*S.Reals)
Out[3]: True

@hargup @flacjacket @jksuom

@aktech aktech added the sets label Jul 13, 2015

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

Ideally, the following should also return True, but I think we should not equate S.Complex to two different objects.

 S.Complex == ComplexPlane(Interval(0, oo)*Interval(0, 2*pi), polar=True)

@hargup
BTW, Should there be something like S.Complex(polar=True) object, for having the case like above?

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jul 13, 2015

I think the name S.Complex is not quite proper for a set of numbers. In analogy with S.Reals, one possibility might be S.Complexes. Otherwise, equating the singleton with ComplexPlane(S.Reals*S.Reals) seems plausible.

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

In analogy with S.Reals, one possibility might be S.Complexes.

I think, that sounds good. I'll change it to S.Complexes.

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

Replaced S.Complex with S.Complexes.
BTW, Wolfram also calls it Complexes.

@aktech aktech changed the title Equate S.Complex with ComplexPlane(S.Reals*S.Reals) Equate S.Complexes with ComplexPlane(S.Reals*S.Reals) Jul 13, 2015

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jul 13, 2015

One deficiency in both S.Reals and S.Complexes is that neither one has any algebraic structure. If such structure were to be added later, the singletons could no more be equated with the set objects in the same way. That may not be important now, but perhaps it should be kept in mind.

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

S.Reals inherits from Interval class & S.Complexes inherits from ComplexPlane class and all the operations are defined on Interval and ComplexPlane classes, doesn't that an algebraic structure?

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jul 13, 2015

It seems to me that the algebraic type operations currently defined for sets are actually set theoretic. Sum (defined by __add__) is union, etc..

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

Yes Indeed, in the Base Set class.

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jul 13, 2015

The algebraic operations could be defined as mappings. For example, the product in S.Complexes would be the mapping from S.Complexes*S.Complexes to S.Complexes taking ((x1, y1), (x2, y2)) to (x1*x2 - y1*y2, x1*y2 + y1*x2).

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

Probably in that case:
ComplexPlane(FiniteSet(x)*FiniteSet(y)) should simplify to {x + I*y}. As of now it doesn't.

In [6]: c1 = ComplexPlane(FiniteSet(x)*FiniteSet(y))
In [7]: c2 = ComplexPlane(FiniteSet(a)*FiniteSet(b))

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

In [9]: c2
Out[9]: ComplexPlane(Lambda((x, y), x + I*y), {a} x {b})

In [10]: c1*c2
Out[10]: ComplexPlane(Lambda((x, y), x + I*y), {x} x {y}) x ComplexPlane(Lambda((x, y), x + I*y), {a} x {b})
@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Jul 13, 2015

I have not been thinking of these matters so far, but using the notation {x + I*y} certainly feels right.

@aktech

This comment has been minimized.

Copy link
Member Author

aktech commented Jul 13, 2015

I have reported the issue here: #9669

@hargup

This comment has been minimized.

Copy link
Member

hargup commented Jul 17, 2015

+1, @aktech also update the name change in the release notes.

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

Merge pull request #9666 from aktech/complex-eq
Equate S.Complexes with ComplexPlane(S.Reals*S.Reals)

@hargup hargup merged commit a94b2ee into sympy:master Jul 17, 2015

1 check passed

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

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

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