o
    *Î®c•  ã                   @   s,   d dl mZ ddlmZ G dd„ deƒZdS )é   )ÚStandard_Cartané    ©ÚMatrixc                   @   sL   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dS )ÚTypeGc                 C   s   |dkrt dƒ‚t | dd¡S )Né   zn should be 2ÚG)Ú
ValueErrorr   Ú__new__)ÚclsÚn© r   ú?/tmp/pip-target-vg8gfxp4/lib/python/sympy/liealgebras/type_g.pyr
      s   zTypeG.__new__c                 C   ó   dS )zíDimension of the vector space V underlying the Lie algebra

        Examples
        ========

        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType("G2")
        >>> c.dimension()
        3
        é   r   ©Úselfr   r   r   Ú	dimension   s   zTypeG.dimensionc                 C   s   |dkrg d¢S g d¢S )aš  The ith simple root of G_2

        Every lie algebra has a unique root system.
        Given a root system Q, there is a subset of the
        roots such that an element of Q is called a
        simple root if it cannot be written as the sum
        of two elements in Q.  If we let D denote the
        set of simple roots, then it is clear that every
        element of Q can be written as a linear combination
        of elements of D with all coefficients non-negative.

        Examples
        ========

        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType("G2")
        >>> c.simple_root(1)
        [0, 1, -1]

        r   ©r   r   éÿÿÿÿ©r   éþÿÿÿr   r   )r   Úir   r   r   Úsimple_root   s   zTypeG.simple_rootc                 C   s.   g d¢g d¢g d¢g d¢g d¢g d¢dœ}|S )aÛ  Generate all the positive roots of A_n

        This is half of all of the roots of A_n; by multiplying all the
        positive roots by -1 we get the negative roots.

        Examples
        ========

        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType("A3")
        >>> c.positive_roots()
        {1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
                5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}

        r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   é   é   é   r   )r   Úrootsr   r   r   Úpositive_roots5   s   ÿzTypeG.positive_rootsc                 C   r   )z;
        Returns the total number of roots of G_2"
        é   r   r   r   r   r   r   J   ó   zTypeG.rootsc                 C   s   t ddg d¢ƒ}|S )aì  The Cartan matrix for G_2

        The Cartan matrix matrix for a Lie algebra is
        generated by assigning an ordering to the simple
        roots, (alpha[1], ...., alpha[l]).  Then the ijth
        entry of the Cartan matrix is (<alpha[i],alpha[j]>).

        Examples
        ========

        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType("G2")
        >>> c.cartan_matrix()
        Matrix([
            [ 2, -1],
            [-3,  2]])

        r   )r   r   éýÿÿÿr   r   )r   Úmr   r   r   Úcartan_matrixP   s   zTypeG.cartan_matrixc                 C   r   )zE
        Returns the number of independent generators of G_2
        é   r   r   r   r   r   Úbasisg   r    zTypeG.basisc                 C   s   d}|S )Nu   0â‰¡<â‰¡0
1   2r   )r   Údiagr   r   r   Údynkin_diagramm   s   zTypeG.dynkin_diagramN)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   r   r#   r%   r'   r   r   r   r   r      s    r   N)Úcartan_typer   Úsympy.core.backendr   r   r   r   r   r   Ú<module>   s   