On Wed, May 6, 2026 at 9:28 PM João Camarneiro <
joao.ca...@ed.ac.uk> wrote:
>
> Hi,
>
> I stumbled upon a strange error with the affine_hull() function for polyhedra. A minimal example is:
>
> pp = Polyhedron(vertices=[[-1, -1, 1, -1], [-1, -1, 5, 1], [-1, 5, -1, 1], [5, -1, -1, 1]])
> pp.affine_hull()
>
> This throws the following error:
> TypeError: no conversion of this rational to integer
>
> If I add "base_ring = QQ", i.e.
> pp = Polyhedron(vertices=[[-1, -1, 1, -1], [-1, -1, 5, 1], [-1, 5, -1, 1], [5, -1, -1, 1]], base_ring=QQ)
> pp.affine_hull()
>
> then everything works fine.
Yes, sure, and you have a vertex with non-integer coordinate.
sage: pp.affine_hull().lines()
(A line in the direction (0, 0, 2, 1),
A line in the direction (2, 0, 0, 1),
A line in the direction (0, 2, 0, 1))
sage: pp.affine_hull().vertices()
(A vertex at (0, 0, 0, -1/2),)
It's because affine_hill() is given by Minkowski sum of a vertex and a
linear hyperplane.
(the latter given by 3 lines)
The hull is an affine hyperplane {x | <x,(1, 1, 1, -2)>=1}
sage: pp.affine_hull().Hrepresentation()
(An equation (1, 1, 1, -2) x - 1 == 0,)
No wonder this breaks for the default base_ring=ZZ.
>
> Is this a bug?
it's a documentation bug, as it's not clear from the docs on
affine_hull that you have such an
unusual representation of the result.
HTH
Dima
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sage-support...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/sage-support/700916ed-e068-4ef0-82da-6bb743b0dbb4n%40googlegroups.com.