The Python backend, using number fields internally - Combinatorial and Discrete Geometry

Skip to content
Back to top
View this page
Edit this page

# The Python backend, using number fields internally

class sage.geometry.polyhedron.backend_number_field.Polyhedron_number_field(parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, pref_rep=None, mutable=False, **kwds)

  Bases: `Polyhedron_field`, `Polyhedron_base_number_field`

  Polyhedra whose data can be converted to number field elements.

  All computations are done internally using a fixed real embedded number field, which is determined automatically.

  INPUT:

  - `Vrep` – list `[vertices, rays, lines]` or `None`

  - `Hrep` – list `[ieqs, eqns]` or `None`

  EXAMPLES:

  Sage

      sage: P = Polyhedron(vertices=[[1], [sqrt(2)]], backend='number_field'); P      # needs sage.rings.number_field sage.symbolic
      A 1-dimensional polyhedron
       in (Symbolic Ring)^1 defined as the convex hull of 2 vertices
      sage: P.vertices()                                                              # needs sage.rings.number_field sage.symbolic
      (A vertex at (1), A vertex at (sqrt(2)))

      sage: P = polytopes.icosahedron(exact=True, backend='number_field')             # needs sage.rings.number_field
      sage: P                                                                         # needs sage.rings.number_field
      A 3-dimensional polyhedron
       in (Number Field in sqrt5 with defining polynomial x^2 - 5
           with sqrt5 = 2.236067977499790?)^3
       defined as the convex hull of 12 vertices

      sage: x = polygen(ZZ); P = Polyhedron(                                          # needs sage.rings.number_field sage.symbolic
      ....:     vertices=[[sqrt(2)], [AA.polynomial_root(x^3-2, RIF(0,3))]],
      ....:     backend='number_field')
      sage: P                                                                         # needs sage.rings.number_field sage.symbolic
      A 1-dimensional polyhedron
       in (Symbolic Ring)^1 defined as the convex hull of 2 vertices
      sage: P.vertices()                                                              # needs sage.rings.number_field sage.symbolic
      (A vertex at (sqrt(2)), A vertex at (2^(1/3)))

  Python

      >>> from sage.all import *
      >>> P = Polyhedron(vertices=[[Integer(1)], [sqrt(Integer(2))]], backend='number_field'); P      # needs sage.rings.number_field sage.symbolic
      A 1-dimensional polyhedron
       in (Symbolic Ring)^1 defined as the convex hull of 2 vertices
      >>> P.vertices()                                                              # needs sage.rings.number_field sage.symbolic
      (A vertex at (1), A vertex at (sqrt(2)))

      >>> P = polytopes.icosahedron(exact=True, backend='number_field')             # needs sage.rings.number_field
      >>> P                                                                         # needs sage.rings.number_field
      A 3-dimensional polyhedron
       in (Number Field in sqrt5 with defining polynomial x^2 - 5
           with sqrt5 = 2.236067977499790?)^3
       defined as the convex hull of 12 vertices

      >>> x = polygen(ZZ); P = Polyhedron(                                          # needs sage.rings.number_field sage.symbolic
      ...     vertices=[[sqrt(Integer(2))], [AA.polynomial_root(x**Integer(3)-Integer(2), RIF(Integer(0),Integer(3)))]],
      ...     backend='number_field')
      >>> P                                                                         # needs sage.rings.number_field sage.symbolic
      A 1-dimensional polyhedron
       in (Symbolic Ring)^1 defined as the convex hull of 2 vertices
      >>> P.vertices()                                                              # needs sage.rings.number_field sage.symbolic
      (A vertex at (sqrt(2)), A vertex at (2^(1/3)))