Ask Your Question
1

unexpected TypeError while creating a polyhedron over ZZ with Normaliz

asked 2021-09-06 20:39:44 +0200

Max Alekseyev gravatar image

updated 2021-09-06 21:18:50 +0200

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 flag offensive close merge delete

Comments

1

Does it have integer vertices ?

FrédéricC gravatar imageFrédéricC ( 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.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-09-06 20:56:48 +0200 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2021-09-06 21:17:35 +0200

Max Alekseyev gravatar image

updated 2021-09-06 21:28:48 +0200

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-09-06 20:39:44 +0200

Seen: 26 times

Last updated: Sep 06

Related questions