Skip to content
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

Add edges() and endpoints() method to intervals #19364

Closed
jdemeyer opened this issue Oct 7, 2015 · 15 comments
Closed

Add edges() and endpoints() method to intervals #19364

jdemeyer opened this issue Oct 7, 2015 · 15 comments

Comments

@jdemeyer
Copy link

jdemeyer commented Oct 7, 2015

Add an edges() method to intervals (elements of RIF and CIF).

  1. For complex intervals, return the 4 edges of the rectangular interval as intervals.
  2. For real intervals, return the endpoints as single-point intervals.

For CIF, we also add an endpoints() method returning the 4 corners of the interval.

In other words, if the given interval lives in some N-dimensional space, then:

  1. edges() returns the (N-1)-dimensional faces as intervals.
  2. endpoints() returns the 0-dimensional faces as points.

Component: basic arithmetic

Author: Jeroen Demeyer

Branch/Commit: 388d495

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/19364

@jdemeyer jdemeyer added this to the sage-6.9 milestone Oct 7, 2015
@jdemeyer

This comment has been minimized.

@jdemeyer jdemeyer changed the title Add edges() method to RIF and CIF elements Add edges() and endpoints() method to RIF and CIF elements Oct 7, 2015
@jdemeyer jdemeyer changed the title Add edges() and endpoints() method to RIF and CIF elements Add edges() and endpoints() method to intervals Oct 7, 2015
@jdemeyer
Copy link
Author

jdemeyer commented Oct 7, 2015

@jdemeyer
Copy link
Author

jdemeyer commented Oct 7, 2015

Commit: 388d495

@jdemeyer
Copy link
Author

jdemeyer commented Oct 7, 2015

New commits:

388d495Add edges() and endpoints() methods to intervals

@jdemeyer jdemeyer modified the milestones: sage-6.9, sage-6.10 Oct 7, 2015
@jdemeyer

This comment has been minimized.

@jdemeyer

This comment has been minimized.

@fchapoton
Copy link
Contributor

comment:7

Strange order:

(lower left, upper right, upper left, lower right)

what is the reason of this choice ?

@jdemeyer
Copy link
Author

jdemeyer commented Oct 7, 2015

comment:8

Replying to @fchapoton:

Strange order:

(lower left, upper right, upper left, lower right)

what is the reason of this choice ?

The rationale is the following: suppose you need 2 endpoints defining the interval (i.e. such that the union is the whole interval). In that case, those endpoints are interval.endpoints()[:2] both in the real and complex case.

For the edges() method, I put pairs of opposing edges next to each other, because an application might want to process such pairs of opposing edges. The fact that the endpoints() method also returns pairs of opposing endpoints is consistent with that.

@videlec
Copy link
Contributor

videlec commented Nov 28, 2015

comment:9

Are both methods really needed? endpoints already contains all the information. The only advantage of edges I see is that the output belongs to the same field.

@jdemeyer
Copy link
Author

comment:10

"needed" is always very subjective. I mean, is Sage (the program as a whole) "needed"?

The main motivation is to allow more easily code which can run unchanged for both RIF and CIF. Depending on the application, that would be either edges() or endpoints() which happen to coincide for RIF but not for CIF.

@videlec
Copy link
Contributor

videlec commented Dec 1, 2015

comment:11

Replying to @jdemeyer:

"needed" is always very subjective. I mean, is Sage (the program as a whole) "needed"?

The main motivation is to allow more easily code which can run unchanged for both RIF and CIF. Depending on the application, that would be either edges() or endpoints() which happen to coincide for RIF but not for CIF.

I understand that you need an implementation in both RIF and CIF. I do not understand why you need two methods. My comment concerned the fact that edges can easily be deduced from endpoints.

@jdemeyer
Copy link
Author

jdemeyer commented Dec 1, 2015

comment:12

Replying to @videlec:

My comment concerned the fact that edges can easily be deduced from endpoints.

It's not really obvious to me how can one easily construct edges given endpoints.

But even then, there is very little harm in having redundant methods. For CIF, I think that both endpoints and edges are useful. Since I want something consistent for RIF and CIF, I also added edges to RIF.

@videlec
Copy link
Contributor

videlec commented Dec 4, 2015

comment:13

Replying to @jdemeyer:

Replying to @videlec:

My comment concerned the fact that edges can easily be deduced from endpoints.

It's not really obvious to me how can one easily construct edges given endpoints.

But even then, there is very little harm in having redundant methods. For CIF, I think that both endpoints and edges are useful. Since I want something consistent for RIF and CIF, I also added edges to RIF.

All right. Let it go.

@videlec
Copy link
Contributor

videlec commented Dec 4, 2015

Reviewer: Vincent Delecroix

@vbraun
Copy link
Member

vbraun commented Dec 5, 2015

Changed branch from u/jdemeyer/add_edges___method_to_rif_and_cif_elements to 388d495

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

No branches or pull requests

4 participants