Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit a47c25b

Browse files
author
Matthias Koeppe
committed
src/sage/geometry/polyhedron/constructor.py: Mark doctests # optional - sage.rings.number_field
1 parent 49658e0 commit a47c25b

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/sage/geometry/polyhedron/constructor.py

+20-19
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@
177177
exact way to work with roots in Sage is the :mod:`Algebraic Real Field
178178
<sage.rings.qqbar>` ::
179179
180-
sage: triangle = Polyhedron([(0,0), (1,0), (1/2, sqrt(3)/2)], base_ring=AA)
181-
sage: triangle.Hrepresentation()
180+
sage: triangle = Polyhedron([(0,0), (1,0), (1/2, sqrt(3)/2)], base_ring=AA) # optional - sage.rings.number_field
181+
sage: triangle.Hrepresentation() # optional - sage.rings.number_field
182182
(An inequality (-1, -0.5773502691896258?) x + 1 >= 0,
183183
An inequality (1, -0.5773502691896258?) x + 0 >= 0,
184184
An inequality (0, 1.154700538379252?) x + 0 >= 0)
@@ -187,20 +187,20 @@
187187
symbolic ring element and, therefore, the polyhedron defined over the
188188
symbolic ring. This is currently not supported as SR is not exact::
189189
190-
sage: Polyhedron([(0,0), (1,0), (1/2, sqrt(3)/2)])
190+
sage: Polyhedron([(0,0), (1,0), (1/2, sqrt(3)/2)]) # optional - sage.symbolic
191191
Traceback (most recent call last):
192192
...
193193
ValueError: no default backend for computations with Symbolic Ring
194194
195-
sage: SR.is_exact()
195+
sage: SR.is_exact() # optional - sage.symbolic
196196
False
197197
198198
Even faster than all algebraic real numbers (the field ``AA``) is
199199
to take the smallest extension field. For the equilateral
200200
triangle, that would be::
201201
202-
sage: K.<sqrt3> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))
203-
sage: Polyhedron([(0,0), (1,0), (1/2, sqrt3/2)])
202+
sage: K.<sqrt3> = NumberField(x^2 - 3, embedding=AA(3)**(1/2)) # optional - sage.rings.number_field
203+
sage: Polyhedron([(0,0), (1,0), (1/2, sqrt3/2)]) # optional - sage.rings.number_field
204204
A 2-dimensional polyhedron in (Number Field in sqrt3 with defining polynomial x^2 - 3 with sqrt3 = 1.732050807568878?)^2 defined as the convex hull of 3 vertices
205205
206206
.. WARNING::
@@ -441,24 +441,25 @@ def Polyhedron(vertices=None, rays=None, lines=None,
441441
by the cyclic shifts of `(0, \pm 1, \pm (1+\sqrt(5))/2)`, cf.
442442
:wikipedia:`Regular_icosahedron`. It needs a number field::
443443
444-
sage: R0.<r0> = QQ[]
445-
sage: R1.<r1> = NumberField(r0^2-5, embedding=AA(5)**(1/2))
446-
sage: gold = (1+r1)/2
447-
sage: v = [[0, 1, gold], [0, 1, -gold], [0, -1, gold], [0, -1, -gold]]
448-
sage: pp = Permutation((1, 2, 3))
449-
sage: icosah = Polyhedron([(pp^2).action(w) for w in v]
450-
....: + [pp.action(w) for w in v] + v, base_ring=R1)
451-
sage: len(icosah.faces(2))
444+
sage: R0.<r0> = QQ[] # optional - sage.rings.number_field
445+
sage: R1.<r1> = NumberField(r0^2-5, embedding=AA(5)**(1/2)) # optional - sage.rings.number_field
446+
sage: gold = (1+r1)/2 # optional - sage.rings.number_field
447+
sage: v = [[0, 1, gold], [0, 1, -gold], [0, -1, gold], [0, -1, -gold]] # optional - sage.rings.number_field
448+
sage: pp = Permutation((1, 2, 3)) # optional - sage.combinat # optional - sage.rings.number_field
449+
sage: icosah = Polyhedron( # optional - sage.combinat # optional - sage.rings.number_field
450+
....: [(pp^2).action(w) for w in v] + [pp.action(w) for w in v] + v,
451+
....: base_ring=R1)
452+
sage: len(icosah.faces(2)) # optional - sage.combinat # optional - sage.rings.number_field
452453
20
453454
454455
When the input contains elements of a Number Field, they require an
455456
embedding::
456457
457-
sage: K = NumberField(x^2-2,'s')
458-
sage: s = K.0
459-
sage: L = NumberField(x^3-2,'t')
460-
sage: t = L.0
461-
sage: P = Polyhedron(vertices = [[0,s],[t,0]])
458+
sage: K = NumberField(x^2-2,'s') # optional - sage.rings.number_field
459+
sage: s = K.0 # optional - sage.rings.number_field
460+
sage: L = NumberField(x^3-2,'t') # optional - sage.rings.number_field
461+
sage: t = L.0 # optional - sage.rings.number_field
462+
sage: P = Polyhedron(vertices = [[0,s],[t,0]]) # optional - sage.rings.number_field
462463
Traceback (most recent call last):
463464
...
464465
ValueError: invalid base ring

0 commit comments

Comments
 (0)