# Discrete Plane¶

Discrete Hyperplanes

Intersection of a plane and a tube:

sage: from slabbe import DiscretePlane, DiscreteTube
sage: p = DiscretePlane([1,pi,7], 1+pi+7, mu=0)
sage: d = DiscreteTube([-5,5],[-5,5])
sage: I = p & d
sage: I
Intersection of the following objects:
Set of points x in ZZ^3 satisfying: 0 <= (1, pi, 7) . x + 0 < pi + 8
DiscreteTube: Preimage of [-5, 5] x [-5, 5] by a 2 by 3 matrix
sage: len(list(I))
115


Intersection of a line and a box:

sage: from slabbe import DiscreteLine, DiscreteBox
sage: L = DiscreteLine([pi,sqrt(2)], pi+sqrt(2), mu=0)
sage: b = DiscreteBox([-5,5],[-5,5])
sage: I = L & b
sage: I
Intersection of the following objects:
Set of points x in ZZ^2 satisfying: 0 <= (pi, sqrt(2)) . x + 0 < pi + sqrt(2)
[-5, 5] x [-5, 5]


TODO:

• do some dimension checking for DiscreteLine and DiscretePlane

class slabbe.discrete_plane.DiscreteHyperplane(v, omega, mu=0, prec=None)

This is the set of point $$p$$ such that

$$0 \leq p \cdot v + mu < \omega$$

INPUT:

• v - normal vector

• omega - width

• mu - intercept (optional, default: 0)

EXAMPLES:

sage: from slabbe import DiscreteLine
sage: L = DiscreteLine([pi,sqrt(2)], pi+sqrt(2), mu=10)
sage: L
Set of points x in ZZ^2 satisfying: 0 <= (pi, sqrt(2)) . x + 10 < pi + sqrt(2)

sage: from slabbe import DiscretePlane
sage: p = DiscretePlane([1,pi,7], 1+pi+7, mu=0)
sage: p
Set of points x in ZZ^3 satisfying: 0 <= (1, pi, 7) . x + 0 < pi + 8

sage: from slabbe import DiscreteHyperplane
sage: p = DiscreteHyperplane([1,3,7,9], 20, mu=13)
sage: p
Set of points x in ZZ^4 satisfying: 0 <= (1, 3, 7, 9) . x + 13 < 20


TESTS:

sage: p = DiscretePlane([1,pi,7], 1+pi+7, mu=20)
sage: vector((0,0,0)) in p
False
sage: p = DiscretePlane([1,pi,7], 1+pi+7, mu=0)
sage: vector((0,0,0)) in p
True

sage: p = DiscreteHyperplane((2,3,4,5), 10)
sage: p.dimension()
4

sage: L = DiscreteLine([1,pi], 1+pi, mu=20)
sage: vector((0,0)) in L
False
sage: L = DiscreteLine([1,pi], 1+pi, mu=0)
sage: vector((0,0)) in L
True

an_element(x=0, y=0)

Returns an element in self.

EXAMPLES:

sage: from slabbe import DiscreteHyperplane
sage: p = DiscreteHyperplane([1,pi,7], 1+pi+7, mu=10)
sage: p.an_element()
(0, 0, 0)

sage: from slabbe import DiscreteLine
sage: L = DiscreteLine([pi,sqrt(2)], pi+sqrt(2), mu=10)
sage: L.an_element()
(-2, -2)

sage: L = DiscreteLine([pi,sqrt(2)], pi+sqrt(2), mu=0)
sage: L.an_element()
(0, 0)

level_value(p)

Return the level value of a point p.

INPUT:

• p - point in the space

EXAMPLES:

sage: from slabbe import DiscreteHyperplane
sage: H = DiscreteHyperplane([1,3,7,9], 20, mu=13)
sage: p = H._space((1,2,3,4))
sage: H.level_value(p)
64

roots()

Return the roots, i.e., a list of elements in self.

It also makes sure the roots are in self and raises an error otherwise.

EXAMPLES:

sage: from slabbe import DiscretePlane
sage: P = DiscretePlane([3,4,5], 12, mu=20)
sage: P.roots()
[(-1, -1, -1)]
sage: all(p in P for p in P.roots())
True

slabbe.discrete_plane.DiscreteLine
slabbe.discrete_plane.DiscretePlane