# unexpected TypeError while creating a polyhedron over ZZ with Normaliz

The following code

Polyhedron( ieqs=[(-1, 1, -1, 0, -4), (2, -1, 1, 0, 4), (0, 1, 1, 2, -2), (2, -1, -1, -2, 2), (0, 0, -1, 1, 1), (1, 0, 1, -1, -1), (0, 1, 0, 0, 1), (1, -1, 0, 0, -1)], base_ring=ZZ, backend='normaliz' )


gives me TypeError: no conversion of this rational to integerin Sage 9.4. It can also be seen in SagMathCell - https://sagecell.sagemath.org/?q=soiohx

The error disappears if base_ring is changed to QQ. What's wrong?

edit retag close merge delete

1

Does it have integer vertices ?

( 2021-09-06 20:51:04 +0200 )edit

Does it have to? I thought it's reduced to the integral hull when defined over ZZ.

( 2021-09-06 20:56:48 +0200 )edit

Sort by » oldest newest most voted

Thanks to the pointer from FrédéricC, it appears that Sage expects that the definition of polyhedron over ZZ is strict with all vertices being integral upfront. The behavior I expected can be achieved by first defining a polyhedron over QQ, computing its integral hull, and then changing base ring to ZZ like

P = Polyhedron( ieqs=[(-1, 1, -1, 0, -4), (2, -1, 1, 0, 4), (0, 1, 1, 2, -2), (2, -1, -1, -2, 2), (0, 0, -1, 1, 1), (1, 0, 1, -1, -1), (0, 1, 0, 0, 1), (1, -1, 0, 0, -1)], base_ring=QQ, backend='normaliz' )
Q = P.integral_hull().change_ring(ZZ)


The error message in the case of non-integral vertices could have been more informative, nevertheless.

more