Skip to content

Commit

Permalink
gh-35267: sage.manifolds, sage.tensor: Add # optional doctest t…
Browse files Browse the repository at this point in the history
…ags for modularization

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
### 📚 Description

<!-- Describe your changes here in detail -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If it resolves an open issue, please link to the issue here. For
example "Closes #1337" -->

Adding tags that make it possible/meaningful to doctest
`sage.manifolds`, `sage.tensor` even when some "standard" packages
(`pplpy`, the modularized distribution packaging providing
`sage.symbolic` and `sage.manifolds`) are not installed. Also taking
care of `sage.geometry.riemannian_manifolds`.

- Part of #29705
- Split out from #34998

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies
<!-- List all open pull requests that this PR logically depends on -->
<!--
- #xyz: short description why this is a dependency
- #abc: ...
-->
This is just two commits on top of:
- #35237
    
URL: #35267
Reported by: Matthias Köppe
Reviewer(s): Eric Gourgoulhon
  • Loading branch information
Release Manager committed Mar 31, 2023
2 parents 428b148 + ac8aa10 commit be6021d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
29 changes: 16 additions & 13 deletions src/sage/geometry/riemannian_manifolds/parametrized_surface3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,25 @@ class ParametrizedSurface3D(SageObject):
sage: u2min, u2max = 0, 6.28
sage: u1num, u2num = 10, 20
sage: # make the arguments array
sage: from numpy import linspace
sage: u1_array = linspace(u1min, u1max, u1num)
sage: u2_array = linspace(u2min, u2max, u2num)
sage: u_array = [ (uu1,uu2) for uu1 in u1_array for uu2 in u2_array]
sage: from numpy import linspace # optional - numpy
sage: u1_array = linspace(u1min, u1max, u1num) # optional - numpy
sage: u2_array = linspace(u2min, u2max, u2num) # optional - numpy
sage: u_array = [(uu1,uu2) for uu1 in u1_array for uu2 in u2_array] # optional - numpy
sage: # Find the gaussian curvature
sage: K(u1,u2) = ellipsoid.gauss_curvature()
sage: # Make array of K values
sage: K_array = [K(uu[0],uu[1]) for uu in u_array]
sage: K(u1,u2) = ellipsoid.gauss_curvature() # optional - numpy
sage: # Make array of K values # optional - numpy
sage: K_array = [K(uu[0],uu[1]) for uu in u_array] # optional - numpy
sage: # Find minimum and max of the Gauss curvature
sage: K_max = max(K_array)
sage: K_min = min(K_array)
sage: K_max = max(K_array) # optional - numpy
sage: K_min = min(K_array) # optional - numpy
sage: # Make the array of color coefficients
sage: cc_array = [ (ccc - K_min)/(K_max - K_min) for ccc in K_array ]
sage: points_array = [ellipsoid_equation(u_array[counter][0],u_array[counter][1]) for counter in range(0,len(u_array)) ]
sage: curvature_ellipsoid_plot = sum( point([xx for xx in points_array[counter]],color=hue(cc_array[counter]/2)) for counter in range(0,len(u_array)) )
sage: curvature_ellipsoid_plot.show(aspect_ratio=1)
sage: cc_array = [(ccc - K_min)/(K_max - K_min) for ccc in K_array] # optional - numpy
sage: points_array = [ellipsoid_equation(u_array[counter][0],u_array[counter][1])
....: for counter in range(0,len(u_array))]
sage: curvature_ellipsoid_plot = sum(point([xx for xx in points_array[counter]], # optional - numpy sage.plot
....: color=hue(cc_array[counter]/2))
....: for counter in range(0,len(u_array)))
sage: curvature_ellipsoid_plot.show(aspect_ratio=1) # optional - numpy sage.plot
We can find the principal curvatures and principal directions of the
elliptic paraboloid::
Expand Down
28 changes: 14 additions & 14 deletions src/sage/manifolds/subsets/pullback.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,23 +261,23 @@ def _is_open(codomain_subset):
PPL polyhedra and not-necessarily-closed polyhedra::
sage: from ppl import Variable, C_Polyhedron, NNC_Polyhedron, Constraint_System
sage: u = Variable(0)
sage: v = Variable(1)
sage: CS = Constraint_System()
sage: CS.insert(0 < u)
sage: CS.insert(u < 1)
sage: CS.insert(0 < v)
sage: CS.insert(v < 1)
sage: CS.insert(u + v <= 3) # redundant inequality
sage: P = NNC_Polyhedron(CS); P
sage: from ppl import Variable, C_Polyhedron, NNC_Polyhedron, Constraint_System # optional - pplpy
sage: u = Variable(0) # optional - pplpy
sage: v = Variable(1) # optional - pplpy
sage: CS = Constraint_System() # optional - pplpy
sage: CS.insert(0 < u) # optional - pplpy
sage: CS.insert(u < 1) # optional - pplpy
sage: CS.insert(0 < v) # optional - pplpy
sage: CS.insert(v < 1) # optional - pplpy
sage: CS.insert(u + v <= 3) # redundant inequality # optional - pplpy
sage: P = NNC_Polyhedron(CS); P # optional - pplpy
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 point, 4 closure_points
sage: ManifoldSubsetPullback._is_open(P)
sage: ManifoldSubsetPullback._is_open(P) # optional - pplpy
True
sage: CS.insert(u + v <= 1)
sage: T = NNC_Polyhedron(CS); T
sage: CS.insert(u + v <= 1) # optional - pplpy
sage: T = NNC_Polyhedron(CS); T # optional - pplpy
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 point, 3 closure_points
sage: ManifoldSubsetPullback._is_open(T)
sage: ManifoldSubsetPullback._is_open(T) # optional - pplpy
False
"""
Expand Down
12 changes: 6 additions & 6 deletions src/sage/tensor/modules/reflexive_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ def base_module(self):
sage: M.base_module() is M
True
sage: M = Manifold(2, 'M')
sage: XM = M.vector_field_module()
sage: XM.base_module() is XM
sage: M = Manifold(2, 'M') # optional - sage.symbolic
sage: XM = M.vector_field_module() # optional - sage.symbolic
sage: XM.base_module() is XM # optional - sage.symbolic
True
"""
return self
Expand All @@ -273,9 +273,9 @@ def tensor_type(self):
sage: M.tensor_type()
(1, 0)
sage: M = Manifold(2, 'M')
sage: XM = M.vector_field_module()
sage: XM.tensor_type()
sage: M = Manifold(2, 'M') # optional - sage.symbolic
sage: XM = M.vector_field_module() # optional - sage.symbolic
sage: XM.tensor_type() # optional - sage.symbolic
(1, 0)
"""
return (1, 0)
Expand Down

0 comments on commit be6021d

Please sign in to comment.