Skip to content

Commit

Permalink
sage.manifolds: Use more block '# needs'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Oct 31, 2023
1 parent b9cc9d2 commit f3f4416
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/tangent_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
manifold S^2
sage: graph_v = v.plot(mapping=F) # needs sage.plot
sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9) # long time, needs sage.plot
sage: graph_v + graph_S2 # long time
sage: graph_v + graph_S2 # long time, needs sage.plot
Graphics3d Object
.. PLOT::
Expand Down
9 changes: 5 additions & 4 deletions src/sage/manifolds/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,18 +900,19 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
An example of plot via a mapping: plot of a point on a 2-sphere viewed
in the 3-dimensional space ``M``::
sage: # needs sage.plot
sage: S2 = Manifold(2, 'S^2', structure='topological')
sage: U = S2.open_subset('U') # the open set covered by spherical coord.
sage: XS.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi')
sage: p = U.point((pi/4, pi/8), name='p')
sage: F = S2.continuous_map(M, {(XS, X): [sin(th)*cos(ph), # needs sage.plot
sage: F = S2.continuous_map(M, {(XS, X): [sin(th)*cos(ph),
....: sin(th)*sin(ph), cos(th)]}, name='F')
sage: F.display()
F: S^2 → M
on U: (th, ph) ↦ (x, y, z) = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th))
sage: g = p.plot(chart=X, mapping=F) # needs sage.plot
sage: gS2 = XS.plot(chart=X, mapping=F, number_values=9) # needs sage.plot
sage: g + gS2 # needs sage.plot
sage: g = p.plot(chart=X, mapping=F)
sage: gS2 = XS.plot(chart=X, mapping=F, number_values=9)
sage: g + gS2
Graphics3d Object
Use of the option ``ambient_coords`` for plots on a 4-dimensional
Expand Down
47 changes: 26 additions & 21 deletions src/sage/manifolds/subsets/pullback.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,15 @@ def __classcall_private__(cls, map, codomain_subset, inverse=None,
TESTS::
sage: # needs sage.geometry.polyhedron
sage: from sage.manifolds.subsets.pullback import ManifoldSubsetPullback
sage: M = Manifold(2, 'R^2', structure='topological')
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
sage: P = Polyhedron(vertices=[[0, 0], [1, 2], [3, 4]]); P # needs sage.geometry.polyhedron
sage: P = Polyhedron(vertices=[[0, 0], [1, 2], [3, 4]]); P
A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices
sage: S = ManifoldSubsetPullback(c_cart, P); S # needs sage.geometry.polyhedron
sage: S = ManifoldSubsetPullback(c_cart, P); S
Subset x_y_inv_P of the 2-dimensional topological manifold R^2
sage: S is ManifoldSubsetPullback(c_cart, P) # needs sage.geometry.polyhedron
sage: S is ManifoldSubsetPullback(c_cart, P)
True
"""
Expand Down Expand Up @@ -605,16 +606,17 @@ def _an_element_(self):
EXAMPLES::
sage: # needs sage.geometry.polyhedron
sage: from sage.manifolds.subsets.pullback import ManifoldSubsetPullback
sage: M = Manifold(3, 'R^3', structure='topological')
sage: c_cart.<x,y,z> = M.chart() # Cartesian coordinates on R^3
sage: Cube = polytopes.cube(); Cube # needs sage.geometry.polyhedron
sage: Cube = polytopes.cube(); Cube
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
sage: McCube = ManifoldSubsetPullback(c_cart, Cube, name='McCube'); McCube # needs sage.geometry.polyhedron
sage: McCube = ManifoldSubsetPullback(c_cart, Cube, name='McCube'); McCube
Subset McCube of the 3-dimensional topological manifold R^3
sage: p = McCube.an_element(); p # needs sage.geometry.polyhedron
sage: p = McCube.an_element(); p
Point on the 3-dimensional topological manifold R^3
sage: p.coordinates(c_cart) # needs sage.geometry.polyhedron
sage: p.coordinates(c_cart)
(0, 0, 0)
sage: # needs sage.geometry.polyhedron
Expand All @@ -638,21 +640,22 @@ def some_elements(self):
EXAMPLES::
sage: # needs sage.geometry.polyhedron
sage: from sage.manifolds.subsets.pullback import ManifoldSubsetPullback
sage: M = Manifold(3, 'R^3', structure='topological')
sage: c_cart.<x,y,z> = M.chart() # Cartesian coordinates on R^3
sage: Cube = polytopes.cube(); Cube # needs sage.geometry.polyhedron
sage: Cube = polytopes.cube(); Cube
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
sage: McCube = ManifoldSubsetPullback(c_cart, Cube, name='McCube'); McCube # needs sage.geometry.polyhedron
sage: McCube = ManifoldSubsetPullback(c_cart, Cube, name='McCube'); McCube
Subset McCube of the 3-dimensional topological manifold R^3
sage: L = list(McCube.some_elements()); L # needs sage.geometry.polyhedron
sage: L = list(McCube.some_elements()); L
[Point on the 3-dimensional topological manifold R^3,
Point on the 3-dimensional topological manifold R^3,
Point on the 3-dimensional topological manifold R^3,
Point on the 3-dimensional topological manifold R^3,
Point on the 3-dimensional topological manifold R^3,
Point on the 3-dimensional topological manifold R^3]
sage: list(p.coordinates(c_cart) for p in L) # needs sage.geometry.polyhedron
sage: list(p.coordinates(c_cart) for p in L)
[(0, 0, 0),
(1, -1, -1),
(1, 0, -1),
Expand Down Expand Up @@ -685,12 +688,13 @@ def __contains__(self, point):
EXAMPLES::
sage: # needs sage.geometry.polyhedron
sage: from sage.manifolds.subsets.pullback import ManifoldSubsetPullback
sage: M = Manifold(3, 'R^3', structure='topological')
sage: c_cart.<x,y,z> = M.chart() # Cartesian coordinates on R^3
sage: Cube = polytopes.cube(); Cube # needs sage.geometry.polyhedron
sage: Cube = polytopes.cube(); Cube
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
sage: Cube.vertices_list() # needs sage.geometry.polyhedron
sage: Cube.vertices_list()
[[1, -1, -1],
[1, 1, -1],
[1, 1, 1],
Expand All @@ -699,15 +703,15 @@ def __contains__(self, point):
[-1, -1, -1],
[-1, 1, -1],
[-1, 1, 1]]
sage: McCube = ManifoldSubsetPullback(c_cart, Cube, name='McCube'); McCube # needs sage.geometry.polyhedron
sage: McCube = ManifoldSubsetPullback(c_cart, Cube, name='McCube'); McCube
Subset McCube of the 3-dimensional topological manifold R^3
sage: p = M.point((0, 0, 0)); p # needs sage.geometry.polyhedron
sage: p = M.point((0, 0, 0)); p
Point on the 3-dimensional topological manifold R^3
sage: p in McCube # needs sage.geometry.polyhedron
sage: p in McCube
True
sage: q = M.point((2, 3, 4)); q # needs sage.geometry.polyhedron
sage: q = M.point((2, 3, 4)); q
Point on the 3-dimensional topological manifold R^3
sage: q in McCube # needs sage.geometry.polyhedron
sage: q in McCube
False
"""
if super().__contains__(point):
Expand Down Expand Up @@ -772,11 +776,12 @@ def is_closed(self):
The pullback of a (closed convex) polyhedron under a chart is closed::
sage: P = Polyhedron(vertices=[[0, 0], [1, 2], [3, 4]]); P # needs sage.geometry.polyhedron
sage: # needs sage.geometry.polyhedron
sage: P = Polyhedron(vertices=[[0, 0], [1, 2], [3, 4]]); P
A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices
sage: McP = ManifoldSubsetPullback(c_cart, P, name='McP'); McP # needs sage.geometry.polyhedron
sage: McP = ManifoldSubsetPullback(c_cart, P, name='McP'); McP
Subset McP of the 2-dimensional topological manifold R^2
sage: McP.is_closed() # needs sage.geometry.polyhedron
sage: McP.is_closed()
True
The pullback of real vector subspaces under a chart is closed::
Expand Down

0 comments on commit f3f4416

Please sign in to comment.