Skip to content

Commit e204ca8

Browse files
author
Release Manager
committed
gh-36679: `src/doc`: Update `# needs` <!-- ^^^^^ 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" --> <!-- Describe your changes here in detail --> Also some doctest cosmetics. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> In part cherry-picked from #35095. <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 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! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36679 Reported by: Matthias Köppe Reviewer(s): David Coudert, Kwankyu Lee, Matthias Köppe
2 parents e37e94d + f43552e commit e204ca8

20 files changed

+210
-160
lines changed

src/doc/de/tutorial/tour_plotting.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. sage-doctest: needs sage.plot sage.symbolic
2+
13
.. _section-plot:
24

35
Plotten

src/doc/en/developer/packaging_sage_library.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ Apparently it does not in a very substantial way:
451451
merely a heuristic. Looking at the source of "entropy", through
452452
``log`` from :mod:`sage.misc.functional`, a runtime dependency on
453453
symbolics comes in. In fact, for this reason, two doctests there are
454-
already marked as ``# optional - sage.symbolic``.
454+
already marked as ``# needs sage.symbolic``.
455455

456456
So if packaged as **sagemath-coding**, now a domain expert would have
457457
to decide whether these dependencies on symbolics are strong enough to

src/doc/en/prep/Calculus.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. -*- coding: utf-8 -*-
1+
.. sage-doctest: needs sage.plot sage.symbolic
22
33
.. linkall
44

src/doc/en/prep/Quickstarts/Differential-Equations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. -*- coding: utf-8 -*-
1+
.. sage-doctest: needs sage.plot sage.symbolic
22
33
.. linkall
44

src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ the examples in ``r.kruskal_test?`` in the notebook.
142142

143143
::
144144

145-
sage: x=r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects # optional - rpy2
146-
sage: y=r([3.8, 2.7, 4.0, 2.4]) # with obstructive airway disease # optional - rpy2
147-
sage: z=r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis # optional - rpy2
148-
sage: a = r([x,y,z]) # make a long R vector of all the data # optional - rpy2
149-
sage: b = r.factor(5*[1]+4*[2]+5*[3]) # create something for R to tell # optional - rpy2
150-
....: # which subjects are which
151-
sage: a; b # show them # optional - rpy2
145+
sage: # optional - rpy2
146+
sage: x = r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects
147+
sage: y = r([3.8, 2.7, 4.0, 2.4]) # with obstructive airway disease
148+
sage: z = r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis
149+
sage: a = r([x,y,z]) # make a long R vector of all the data
150+
sage: b = r.factor(5*[1] + 4*[2] + 5*[3]) # create something for R to tell
151+
....: # which subjects are which
152+
sage: a; b # show them
152153
[1] 2.9 3.0 2.5 2.6 3.2 3.8 2.7 4.0 2.4 2.8 3.4 3.7 2.2 2.0
153154
[1] 1 1 1 1 1 2 2 2 2 3 3 3 3 3
154155
Levels: 1 2 3

src/doc/en/prep/Symbolics-and-Basic-Plotting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. -*- coding: utf-8 -*-
1+
.. sage-doctest: needs sage.plot sage.symbolic
22
33
.. linkall
44

src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst

Lines changed: 63 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ and some rays.
9191

9292
::
9393

94-
sage: P1 = Polyhedron(vertices = [[1, 0], [0, 1]], rays = [[1, 1]])
94+
sage: P1 = Polyhedron(vertices=[[1, 0], [0, 1]], rays=[[1, 1]])
9595
sage: P1
9696
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 2 vertices and 1 ray
9797

@@ -118,9 +118,9 @@ We can also add a lineality space.
118118

119119
::
120120

121-
sage: P2 = Polyhedron(vertices = [[1/2, 0, 0], [0, 1/2, 0]],
122-
....: rays = [[1, 1, 0]],
123-
....: lines = [[0, 0, 1]])
121+
sage: P2 = Polyhedron(vertices=[[1/2, 0, 0], [0, 1/2, 0]],
122+
....: rays=[[1, 1, 0]],
123+
....: lines=[[0, 0, 1]])
124124
sage: P2
125125
A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 2 vertices, 1 ray, 1 line
126126
sage: P2.plot()
@@ -144,7 +144,7 @@ The chosen ring depends on the input format.
144144

145145
::
146146

147-
sage: P3 = Polyhedron(vertices = [[0.5, 0], [0, 0.5]])
147+
sage: P3 = Polyhedron(vertices=[[0.5, 0], [0, 0.5]])
148148
sage: P3
149149
A 1-dimensional polyhedron in RDF^2 defined as the convex hull of 2 vertices
150150
sage: P3.parent()
@@ -163,22 +163,22 @@ The following example demonstrates the limitations of :code:`RDF`.
163163

164164
::
165165

166-
sage: D = polytopes.dodecahedron() # optional - sage.rings.number_field
167-
sage: D # optional - sage.rings.number_field
166+
sage: D = polytopes.dodecahedron() # needs sage.rings.number_field
167+
sage: D # needs sage.rings.number_field
168168
A 3-dimensional polyhedron
169169
in (Number Field in sqrt5 with defining polynomial x^2 - 5
170170
with sqrt5 = 2.236067977499790?)^3
171171
defined as the convex hull of 20 vertices
172172

173-
sage: vertices_RDF = [n(v.vector(),digits=6) for v in D.vertices()] # optional - sage.rings.number_field
174-
sage: D_RDF = Polyhedron(vertices=vertices_RDF, base_ring=RDF) # optional - sage.rings.number_field
173+
sage: vertices_RDF = [n(v.vector(),digits=6) for v in D.vertices()] # needs sage.rings.number_field
174+
sage: D_RDF = Polyhedron(vertices=vertices_RDF, base_ring=RDF) # needs sage.rings.number_field
175175
doctest:warning
176176
...
177177
UserWarning: This polyhedron data is numerically complicated; cdd
178178
could not convert between the inexact V and H representation
179179
without loss of data. The resulting object might show
180180
inconsistencies.
181-
sage: D_RDF = Polyhedron(vertices=sorted(vertices_RDF), base_ring=RDF) # optional - sage.rings.number_field
181+
sage: D_RDF = Polyhedron(vertices=sorted(vertices_RDF), base_ring=RDF) # needs sage.rings.number_field
182182
Traceback (most recent call last):
183183
...
184184
ValueError: *Error: Numerical inconsistency is found. Use the GMP exact arithmetic.
@@ -199,11 +199,12 @@ It is also possible to define a polyhedron over algebraic numbers.
199199

200200
::
201201

202-
sage: sqrt_2 = AA(2)^(1/2) # optional - sage.rings.number_field
203-
sage: cbrt_2 = AA(2)^(1/3) # optional - sage.rings.number_field
204-
sage: timeit('Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]])') # optional - sage.rings.number_field # random
202+
sage: # needs sage.rings.number_field
203+
sage: sqrt_2 = AA(2)^(1/2)
204+
sage: cbrt_2 = AA(2)^(1/3)
205+
sage: timeit('Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]])') # random
205206
5 loops, best of 3: 43.2 ms per loop
206-
sage: P4 = Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]]); P4 # optional - sage.rings.number_field
207+
sage: P4 = Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]]); P4
207208
A 1-dimensional polyhedron in AA^2 defined as the convex hull of 2 vertices
208209

209210
.. end of output
@@ -212,11 +213,12 @@ There is another way to create a polyhedron over algebraic numbers:
212213

213214
::
214215

215-
sage: K.<a> = NumberField(x^2 - 2, embedding=AA(2)**(1/2)) # optional - sage.rings.number_field
216-
sage: L.<b> = NumberField(x^3 - 2, embedding=AA(2)**(1/3)) # optional - sage.rings.number_field
217-
sage: timeit('Polyhedron(vertices = [[a, 0], [0, b]])') # optional - sage.rings.number_field # random
216+
sage: # needs sage.rings.number_field
217+
sage: K.<a> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))
218+
sage: L.<b> = NumberField(x^3 - 2, embedding=AA(2)**(1/3))
219+
sage: timeit('Polyhedron(vertices=[[a, 0], [0, b]])') # random
218220
5 loops, best of 3: 39.9 ms per loop
219-
sage: P5 = Polyhedron(vertices = [[a, 0], [0, b]]); P5 # optional - sage.rings.number_field
221+
sage: P5 = Polyhedron(vertices=[[a, 0], [0, b]]); P5
220222
A 1-dimensional polyhedron in AA^2 defined as the convex hull of 2 vertices
221223

222224
.. end of output
@@ -225,10 +227,11 @@ If the base ring is known it may be a good option to use the proper :meth:`sage.
225227

226228
::
227229

228-
sage: J = K.composite_fields(L)[0] # optional - sage.rings.number_field
229-
sage: timeit('Polyhedron(vertices = [[J(a), 0], [0, J(b)]])') # optional - sage.rings.number_field # random
230+
sage: # needs sage.rings.number_field
231+
sage: J = K.composite_fields(L)[0]
232+
sage: timeit('Polyhedron(vertices=[[J(a), 0], [0, J(b)]])') # random
230233
25 loops, best of 3: 9.8 ms per loop
231-
sage: P5_comp = Polyhedron(vertices = [[J(a), 0], [0, J(b)]]); P5_comp # optional - sage.rings.number_field
234+
sage: P5_comp = Polyhedron(vertices=[[J(a), 0], [0, J(b)]]); P5_comp
232235
A 1-dimensional polyhedron
233236
in (Number Field in ab with defining polynomial
234237
x^6 - 6*x^4 - 4*x^3 + 12*x^2 - 24*x - 4
@@ -242,9 +245,9 @@ It is not possible to define a polyhedron over it:
242245

243246
::
244247

245-
sage: sqrt_2s = sqrt(2) # optional - sage.symbolic
246-
sage: cbrt_2s = 2^(1/3) # optional - sage.symbolic
247-
sage: Polyhedron(vertices = [[sqrt_2s, 0], [0, cbrt_2s]]) # optional - sage.symbolic
248+
sage: sqrt_2s = sqrt(2) # needs sage.symbolic
249+
sage: cbrt_2s = 2^(1/3) # needs sage.symbolic
250+
sage: Polyhedron(vertices=[[sqrt_2s, 0], [0, cbrt_2s]]) # needs sage.symbolic
248251
Traceback (most recent call last):
249252
...
250253
ValueError: no default backend for computations with Symbolic Ring
@@ -389,7 +392,7 @@ inequalities and equalities as objects.
389392

390393
::
391394

392-
sage: P3_QQ = Polyhedron(vertices = [[0.5, 0], [0, 0.5]], base_ring=QQ)
395+
sage: P3_QQ = Polyhedron(vertices=[[0.5, 0], [0, 0.5]], base_ring=QQ)
393396
sage: HRep = P3_QQ.Hrepresentation()
394397
sage: H1 = HRep[0]; H1
395398
An equation (2, 2) x - 1 == 0
@@ -527,7 +530,7 @@ In order to use a specific backend, we specify the :code:`backend` parameter.
527530

528531
::
529532

530-
sage: P1_cdd = Polyhedron(vertices = [[1, 0], [0, 1]], rays = [[1, 1]], backend='cdd')
533+
sage: P1_cdd = Polyhedron(vertices=[[1, 0], [0, 1]], rays=[[1, 1]], backend='cdd')
531534
sage: P1_cdd
532535
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 2 vertices and 1 ray
533536

@@ -567,7 +570,7 @@ The :code:`cdd` backend accepts also entries in :code:`RDF`:
567570

568571
::
569572

570-
sage: P3_cdd = Polyhedron(vertices = [[0.5, 0], [0, 0.5]], backend='cdd')
573+
sage: P3_cdd = Polyhedron(vertices=[[0.5, 0], [0, 0.5]], backend='cdd')
571574
sage: P3_cdd
572575
A 1-dimensional polyhedron in RDF^2 defined as the convex hull of 2 vertices
573576

@@ -577,12 +580,12 @@ but not algebraic or symbolic values:
577580

578581
::
579582

580-
sage: P4_cdd = Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]], backend='cdd') # optional - sage.rings.number_field
583+
sage: P4_cdd = Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]], backend='cdd') # needs sage.rings.number_field
581584
Traceback (most recent call last):
582585
...
583586
ValueError: No such backend (=cdd) implemented for given basering (=Algebraic Real Field).
584587

585-
sage: P5_cdd = Polyhedron(vertices = [[sqrt_2s, 0], [0, cbrt_2s]], backend='cdd') # optional - sage.symbolic
588+
sage: P5_cdd = Polyhedron(vertices=[[sqrt_2s, 0], [0, cbrt_2s]], backend='cdd') # needs sage.symbolic
586589
Traceback (most recent call last):
587590
...
588591
ValueError: No such backend (=cdd) implemented for given basering (=Symbolic Ring).
@@ -656,8 +659,8 @@ An example with quadratic field:
656659

657660
::
658661

659-
sage: V = polytopes.dodecahedron().vertices_list() # optional - sage.rings.number_field
660-
sage: Polyhedron(vertices=V, backend='polymake') # optional - jupymake # optional - sage.rings.number_field
662+
sage: V = polytopes.dodecahedron().vertices_list() # needs sage.rings.number_field
663+
sage: Polyhedron(vertices=V, backend='polymake') # optional - jupymake # needs sage.rings.number_field
661664
A 3-dimensional polyhedron
662665
in (Number Field in sqrt5 with defining polynomial x^2 - 5
663666
with sqrt5 = 2.236067977499790?)^3
@@ -681,7 +684,7 @@ examples.
681684

682685
::
683686

684-
sage: type(D) # optional - sage.rings.number_field
687+
sage: type(D) # needs sage.rings.number_field
685688
<class 'sage.geometry.polyhedron.parent.Polyhedra_field_with_category.element_class'>
686689

687690
.. end of output
@@ -691,13 +694,14 @@ backend :code:`field` is called.
691694

692695
::
693696

694-
sage: P4.parent() # optional - sage.rings.number_field
697+
sage: # needs sage.rings.number_field
698+
sage: P4.parent()
695699
Polyhedra in AA^2
696-
sage: P5.parent() # optional - sage.rings.number_field
700+
sage: P5.parent()
697701
Polyhedra in AA^2
698-
sage: type(P4) # optional - sage.rings.number_field
702+
sage: type(P4)
699703
<class 'sage.geometry.polyhedron.parent.Polyhedra_field_with_category.element_class'>
700-
sage: type(P5) # optional - sage.rings.number_field
704+
sage: type(P5)
701705
<class 'sage.geometry.polyhedron.parent.Polyhedra_field_with_category.element_class'>
702706

703707
.. end of output
@@ -709,13 +713,15 @@ The fourth backend is :code:`normaliz` and is an optional Sage package.
709713

710714
::
711715

712-
sage: P1_normaliz = Polyhedron(vertices = [[1, 0], [0, 1]], rays = [[1, 1]], backend='normaliz') # optional - pynormaliz
713-
sage: type(P1_normaliz) # optional - pynormaliz
716+
sage: # optional - pynormaliz
717+
sage: P1_normaliz = Polyhedron(vertices=[[1, 0], [0, 1]], rays=[[1, 1]],
718+
....: backend='normaliz')
719+
sage: type(P1_normaliz)
714720
<class 'sage.geometry.polyhedron.parent.Polyhedra_QQ_normaliz_with_category.element_class'>
715-
sage: P2_normaliz = Polyhedron(vertices = [[1/2, 0, 0], [0, 1/2, 0]], # optional - pynormaliz
716-
....: rays = [[1, 1, 0]],
717-
....: lines = [[0, 0, 1]], backend='normaliz')
718-
sage: type(P2_normaliz) # optional - pynormaliz
721+
sage: P2_normaliz = Polyhedron(vertices=[[1/2, 0, 0], [0, 1/2, 0]],
722+
....: rays=[[1, 1, 0]],
723+
....: lines=[[0, 0, 1]], backend='normaliz')
724+
sage: type(P2_normaliz)
719725
<class 'sage.geometry.polyhedron.parent.Polyhedra_QQ_normaliz_with_category.element_class'>
720726

721727
.. end of output
@@ -724,7 +730,7 @@ This backend does not work with :code:`RDF` or other inexact fields.
724730

725731
::
726732

727-
sage: P3_normaliz = Polyhedron(vertices = [[0.5, 0], [0, 0.5]], backend='normaliz') # optional - pynormaliz
733+
sage: P3_normaliz = Polyhedron(vertices=[[0.5, 0], [0, 0.5]], backend='normaliz') # optional - pynormaliz
728734
Traceback (most recent call last):
729735
...
730736
ValueError: No such backend (=normaliz) implemented for given basering (=Real Double Field).
@@ -738,12 +744,14 @@ the computation is done using an embedded number field.
738744

739745
::
740746

741-
sage: P4_normaliz = Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]], backend='normaliz') # optional - pynormaliz
742-
sage: P4_normaliz # optional - pynormaliz
747+
sage: # optional - pynormaliz
748+
sage: P4_normaliz = Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]],
749+
....: backend='normaliz')
750+
sage: P4_normaliz
743751
A 1-dimensional polyhedron in AA^2 defined as the convex hull of 2 vertices
744-
745-
sage: P5_normaliz = Polyhedron(vertices = [[sqrt_2s, 0], [0, cbrt_2s]], backend='normaliz') # optional - pynormaliz
746-
sage: P5_normaliz # optional - pynormaliz
752+
sage: P5_normaliz = Polyhedron(vertices=[[sqrt_2s, 0], [0, cbrt_2s]],
753+
....: backend='normaliz')
754+
sage: P5_normaliz
747755
A 1-dimensional polyhedron in (Symbolic Ring)^2 defined as the convex hull of 2 vertices
748756

749757
.. end of output
@@ -753,12 +761,14 @@ The backend :code:`normaliz` provides other methods such as
753761

754762
::
755763

756-
sage: P6 = Polyhedron(vertices = [[0, 0], [3/2, 0], [3/2, 3/2], [0, 3]], backend='normaliz') # optional - pynormaliz
757-
sage: IH = P6.integral_hull(); IH # optional - pynormaliz
764+
sage: # optional - pynormaliz
765+
sage: P6 = Polyhedron(vertices=[[0, 0], [3/2, 0], [3/2, 3/2], [0, 3]],
766+
....: backend='normaliz')
767+
sage: IH = P6.integral_hull(); IH
758768
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 4 vertices
759-
sage: P6.plot(color='blue')+IH.plot(color='red') # optional - pynormaliz
769+
sage: P6.plot(color='blue') + IH.plot(color='red')
760770
Graphics object consisting of 12 graphics primitives
761-
sage: P1_normaliz.integral_hull() # optional - pynormaliz
771+
sage: P1_normaliz.integral_hull()
762772
A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 2 vertices and 1 ray
763773

764774
.. end of output
@@ -788,7 +798,7 @@ polytope is already defined!
788798

789799
::
790800

791-
sage: A = polytopes.buckyball(); A # can take long # optional - sage.rings.number_field
801+
sage: A = polytopes.buckyball(); A # can take long # needs sage.rings.number_field
792802
A 3-dimensional polyhedron
793803
in (Number Field in sqrt5 with defining polynomial x^2 - 5
794804
with sqrt5 = 2.236067977499790?)^3

0 commit comments

Comments
 (0)