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

Bad determination of the coordinate range when restricting charts to subdomains #32929

Closed
egourgoulhon opened this issue Nov 24, 2021 · 17 comments

Comments

@egourgoulhon
Copy link
Member

Since Sage 9.4, we have

sage: M = Manifold(2, 'M')
sage: X.<x,y> = M.chart(r"x:(0,+oo) y:(0,2):periodic")
sage: X.coord_range()
x: (0, +oo); y: [0, 2] (periodic)
sage: U = M.open_subset('U', coord_def={X: x<1})
sage: X.restrict(U).coord_range()
x: (-oo, 1); y: (-oo, +oo)

The lower bound for x should be O, not -oo, and y should appear as a periodic coordinate, i.e. one should get

sage: X.restrict(U).coord_range()
x: (0, 1); y: [0, 2] (periodic)

Sage <= 9.3 was free of this bug. In Sage >= 9.4, one can trace it to the optional argument bounds of RealChart.__init__, which is used in RealChart.restrict (cf. the line res = type(self)(..., bounds=self._bounds, ...))
and which is not correctly transmitted by Chart.__classcall__.

CC: @mkoeppe @tscrim @mjungmath

Component: manifolds

Keywords: chart

Author: Eric Gourgoulhon

Branch/Commit: b5f7af5

Reviewer: Travis Scrimshaw

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

@egourgoulhon
Copy link
Member Author

comment:2

Here is a proposed fix. The bug was triggered in Chart.__classcall__ by the unconditional resetting of the argument coordinate_options, so that neither bounds nor periods could be transmitted to __init__ while constructing the restricted chart in Chart.restrict or RealChart.restrict.

In correcting the bug, I had to change the attribute _periods of charts from a dictionary to a tuple, to make it hashable. Hence the changes in the file point.py (method ManifoldPoint.__eq__). As a benefit, the output of Chart.periods() is more readable.

The doctest change in line 669 of manifold.py simply restores the correct coordinate values for a point constructed via TopologicalManifold._an_element_(). Indeed, git blame reveals that this doctest was incorrectly changed when the bug was introduced in Sage 9.4.


New commits:

3ad5407Fix bug in chart restrictions to subdomain (#32929)

@egourgoulhon
Copy link
Member Author

@egourgoulhon

This comment has been minimized.

@egourgoulhon
Copy link
Member Author

Commit: 3ad5407

@egourgoulhon
Copy link
Member Author

Changed keywords from none to chart

@egourgoulhon
Copy link
Member Author

Author: Eric Gourgoulhon

@tscrim
Copy link
Collaborator

tscrim commented Nov 29, 2021

comment:5

Just a trivial change for doc formatting:

         - a tuple of variables (as elements of ``SR``)
         - a dictionary with possible keys:
-          - `"periods"`: a tuple of periods
-          - `"bounds"`: a tuple of coordinate ranges
+
+          * ``"periods"``: a tuple of periods
+          * ``"bounds"``: a tuple of coordinate ranges

Once changed, you can set a positive review.

@tscrim
Copy link
Collaborator

tscrim commented Nov 29, 2021

Reviewer: Travis Scrimshaw

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 29, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

33bdc1cFix docstring formatting in #32929

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 29, 2021

Changed commit from 3ad5407 to 33bdc1c

@egourgoulhon
Copy link
Member Author

comment:7

Replying to @tscrim:

Thank you for the review!

Just a trivial change for doc formatting:

Corrected in the above commit.

@tscrim
Copy link
Collaborator

tscrim commented Nov 29, 2021

comment:8

The other thing that is needed (I believe) in the blank line between the indented bullets.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 29, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

b5f7af5Fix documentation for #32929

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 29, 2021

Changed commit from 33bdc1c to b5f7af5

@egourgoulhon
Copy link
Member Author

comment:10

Replying to @tscrim:

The other thing that is needed (I believe) in the blank line between the indented bullets.

Thanks for catching this. This is corrected in the last commit.

@egourgoulhon
Copy link
Member Author

comment:11

in view of comment:5.

Thank you Travis!

@vbraun
Copy link
Member

vbraun commented Dec 12, 2021

Changed branch from public/manifolds/bug_chart_restrict-32929 to b5f7af5

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

3 participants