Opened 8 years ago

# Bug creating Polyhedron from lines in number field — at Version 6

Reported by: Owned by: Mark Bell major sage-7.4 number theory Polyhedron, Number field Frédéric Chapoton, Jean-Philippe Labbé, Jakob Kroeker N/A

I reported this to the google group (https://groups.google.com/forum/#!topic/sage-support/ew0bnGzjm98) but was told to repeat it here.

To create polyhedra quickly, the final suggestion in the Polyhedron documentation (http://www.sagemath.org/doc/reference/geometry/sage/geometry/polyhedron/constructor.html#base-rings) is to work in a set number field. Although this appears to work for setting vertices, it does not appear to work for lines (or rays).

For example:

```sage: var('x')
x
sage: K.<sqrt3> = NumberField(x^2-3, embedding=1.732)
sage: P = Polyhedron(lines=[(1,sqrt3)])
sage: P
A 1-dimensional polyhedron in (Number Field in sqrt3 with defining polynomial x^10 + x^2 - 3)^2 defined as the convex hull of 1 vertex and 2 rays
sage: P.rays()
(A ray in the direction (0, -sqrt3), A ray in the direction (1, sqrt3))
```

This should be compared with:

```sage: P = Polyhedron(lines=[(1, sqrt(3))])
sage: P
A 1-dimensional polyhedron in (Symbolic Ring)^2 defined as the convex hull of 1 vertex and 1 line
```

and

```sage: P = Polyhedron(lines=[(1, sqrt(3))], base_ring=AA)
sage: P
A 1-dimensional polyhedron in AA^2 defined as the convex hull of 1 vertex and 1 line
```

Additionally, how can a "1-dimensional polyhedron" be "defined as the convex hull of 1 vertex and 2 rays"?

As pointed out below this is an issue with Polyhedron using a number fields < comparison

```sage: K.<x> = NumberField(x^3 - 1001, embedding=10)
sage: x > x + 1
True
```

### comment:1 Changed 8 years ago by Volker Braun

With 6.4.beta6 I get

```sage: Polyhedron(lines=[(1,sqrt3)])
A 1-dimensional polyhedron in (Number Field in sqrt3 with defining polynomial x^2 - 3)^2 defined as the convex hull of 1 vertex and 1 line
```

### comment:2 Changed 8 years ago by Volker Braun

Though the original example fails:

```sage: K.<L> = NumberField(x^3 + 3*x^2 - 83*x - 1022, embedding=11.6515)
sage: Polyhedron(eqns=[[0, -L - 2, -8, 2], [0, -2, -L + 6, 9], [0, -9, 5, -L - 7]])
A 3-dimensional polyhedron in (Number Field in L with defining polynomial x^3 + 3*x^2 - 83*x - 1022)^3 defined as the convex hull of 1 vertex, 2 rays, 1 line
```

Slightly simpler failure:

```sage: Polyhedron(eqns=[[0, -L - 2, -8], [0, -2, -L + 6], [0, -9, 5]])
A 2-dimensional polyhedron in (Number Field in L with defining polynomial x^3 + 3*x^2 - 83*x - 1022)^2 defined as the convex hull of 1 vertex and 2 rays
```
Last edited 8 years ago by Volker Braun (previous) (diff)

### comment:3 follow-up:  4 Changed 8 years ago by Volker Braun

This originates at the following comparison:

```sage: v = -1/392*L^2 - 45/392*L - 239/392
sage: v > 0
True
sage: v.n()
-2.29356924372991
```

### comment:4 in reply to:  3 Changed 8 years ago by Mark Bell

Thanks for tracking this down. Should I file a separate ticket for this under the number theory?

### comment:5 Changed 8 years ago by Volker Braun

You can just change the description and use this ticket. I think we agree that this is not a bug in polyhedra. See also the discussion on sage-devel.

### comment:6 Changed 8 years ago by Mark Bell

Component: geometry → number theory modified (diff)
Note: See TracTickets for help on using tickets.