예제 #1
0
def vectorconf_to_hyperplane_arrangement(vector_conf, backend=None):
    r"""
    Return the hyperplane arrangement associated to the vector configuration
    ``vector_conf``.

    INPUT:

    - ``vector_conf`` -- a vector configuration

    - ``backend`` -- string (default = ``None``). The backend to use.

    OUTPUT:

    A hyperplane arrangement

    EXAMPLES:

    The arrangement `A(10,60)_3` with 10 hyperplanes is the smallest rank-three 
    simplicial arrangement that is not congruence normal::

        sage: from cn_hyperarr.main import *
        sage: tau = AA((1+sqrt(5))/2)
        sage: ncn = [[2*tau + 1, 2*tau, tau], [2*tau + 2, 2*tau + 1, tau + 1], 
        ....:        [1, 1, 1], [tau + 1, tau + 1, tau], [2*tau, 2*tau, tau], 
        ....:        [tau + 1, tau + 1, 1], [1, 1, 0], [0, 1, 0], [1, 0, 0], 
        ....:        [tau + 1, tau, tau]]
        sage: ncn_conf = VectorConfiguration(ncn);
        sage: ncn_arr = vectorconf_to_hyperplane_arrangement(ncn_conf); ncn_arr
        Arrangement of 10 hyperplanes of dimension 3 and rank 3

    Using normaliz as backend::

        sage: ncn_conf_norm = VectorConfiguration(ncn, 'normaliz')   # optional - pynormaliz
        sage: ncn_conf_norm.backend()                                # optional - pynormaliz
        'normaliz'
    """
    if not isinstance(vector_conf, VectorConfiguration):
        vector_conf = VectorConfiguration(vector_conf, backend=backend)
    if vector_conf.base_ring() == ZZ:
        H = HyperplaneArrangements(QQ, names='xyz')
    else:
        H = HyperplaneArrangements(vector_conf.base_ring(), names='xyz')
    x, y, z = H.gens()
    A = H(backend=vector_conf.backend())
    for v in vector_conf:
        a, b, c = v
        A = A.add_hyperplane(a * x + b * y + c * z)
    return A
예제 #2
0
def make_parent(base_ring, dimension, names=None):
    """
    Construct the parent for the hyperplane arrangements.

    For internal use only.

    INPUT:

    - ``base_ring`` -- a ring

    - ``dimension`` -- integer

    - ``names`` -- ``None`` (default) or a list/tuple/iterable of
      strings

    OUTPUT:

    A new
    :class:`~sage.geometry.hyperplane_arrangement.arrangement.HyperplaneArrangements`
    instance.

    EXAMPLES::

        sage: from sage.geometry.hyperplane_arrangement.library import make_parent
        sage: make_parent(QQ, 3)
        Hyperplane arrangements in 3-dimensional linear space over
        Rational Field with coordinates t0, t1, t2
    """
    if names is None:
        names = tuple('t'+str(i) for i in range(dimension))
    else:
        names = tuple(map(str, names))
        if len(names) != dimension:
            raise ValueError('number of variable names does not match dimension')
    return HyperplaneArrangements(base_ring, names=names)
예제 #3
0
        def inversion_arrangement(self, side='right'):
            r"""
            Return the inversion hyperplane arrangement of ``self``.

            INPUT:

            - ``side`` -- ``'right'`` (default) or ``'left'``

            OUTPUT:

            A (central) hyperplane arrangement whose hyperplanes correspond
            to the inversions of ``self`` given as roots.

            The ``side`` parameter determines on which side
            to compute the inversions.

            EXAMPLES::

                sage: W = WeylGroup(['A',3])
                sage: w = W.from_reduced_word([1, 2, 3, 1, 2])
                sage: A = w.inversion_arrangement(); A
                Arrangement of 5 hyperplanes of dimension 3 and rank 3
                sage: A.hyperplanes()
                (Hyperplane 0*a1 + 0*a2 + a3 + 0,
                 Hyperplane 0*a1 + a2 + 0*a3 + 0,
                 Hyperplane 0*a1 + a2 + a3 + 0,
                 Hyperplane a1 + a2 + 0*a3 + 0,
                 Hyperplane a1 + a2 + a3 + 0)

            The identity element gives the empty arrangement::

                sage: W = WeylGroup(['A',3])
                sage: W.one().inversion_arrangement()
                Empty hyperplane arrangement of dimension 3
            """
            inv = self.inversions(side=side, inversion_type='roots')
            from sage.geometry.hyperplane_arrangement.arrangement import HyperplaneArrangements
            I = self.parent().cartan_type().index_set()
            from sage.rings.rational_field import QQ
            H = HyperplaneArrangements(QQ, tuple(['a{}'.format(i) for i in I]))
            gens = H.gens()
            if not inv:
                return H()
            return H([sum(c * gens[I.index(i)] for (i, c) in root)
                      for root in inv])
예제 #4
0
        def inversion_arrangement(self, side='right'):
            r"""
            Return the inversion hyperplane arrangement of ``self``.

            INPUT:

            - ``side`` -- ``'right'`` (default) or ``'left'``

            OUTPUT:

            A (central) hyperplane arrangement whose hyperplanes correspond
            to the inversions of ``self`` given as roots.

            The ``side`` parameter determines on which side
            to compute the inversions.

            EXAMPLES::

                sage: W = WeylGroup(['A',3])
                sage: w = W.from_reduced_word([1, 2, 3, 1, 2])
                sage: A = w.inversion_arrangement(); A
                Arrangement of 5 hyperplanes of dimension 3 and rank 3
                sage: A.hyperplanes()
                (Hyperplane 0*a1 + 0*a2 + a3 + 0,
                 Hyperplane 0*a1 + a2 + 0*a3 + 0,
                 Hyperplane 0*a1 + a2 + a3 + 0,
                 Hyperplane a1 + a2 + 0*a3 + 0,
                 Hyperplane a1 + a2 + a3 + 0)

            The identity element gives the empty arrangement::

                sage: W = WeylGroup(['A',3])
                sage: W.one().inversion_arrangement()
                Empty hyperplane arrangement of dimension 3
            """
            inv = self.inversions(side=side, inversion_type='roots')
            from sage.geometry.hyperplane_arrangement.arrangement import HyperplaneArrangements
            I = self.parent().cartan_type().index_set()
            H = HyperplaneArrangements(QQ, tuple(['a{}'.format(i) for i in I]))
            gens = H.gens()
            if not inv:
                return H()
            return H([sum(c * gens[I.index(i)] for (i, c) in root)
                      for root in inv])
예제 #5
0
파일: hyperplane.py 프로젝트: ozzie00/sage
    def __or__(self, other):
        """
        Construct hyperplane arrangement from bitwise or.

        EXAMPLES::

            sage: L.<x, y> = HyperplaneArrangements(QQ)
            sage: x | y + 1
            Arrangement <y + 1 | x>
            sage: x | [(0,1), 1]
            Arrangement <y + 1 | x>
        
        TESTS::

            sage: (x | y).parent() is L
            True
        """
        from sage.geometry.hyperplane_arrangement.arrangement import HyperplaneArrangements
        parent = self.parent()
        arrangement = HyperplaneArrangements(parent.base_ring(), names=parent._names)
        return arrangement(self, other)