o
    *ήcA                     @   s0   d dl mZ ddlmZmZ G dd deZdS )   )Standard_Cartan    )MatrixRationalc                   @   sT   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d ZdS )TypeFc                 C   s   |dkrt dt| ddS )N   zn should be 4F)
ValueErrorr   __new__)clsn r   ?/tmp/pip-target-vg8gfxp4/lib/python/sympy/liealgebras/type_f.pyr
      s   zTypeF.__new__c                 C      dS )zDimension of the vector space V underlying the Lie algebra

        Examples
        ========

        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType("F4")
        >>> c.dimension()
        4
        r   r   selfr   r   r   	dimension   s   zTypeF.dimensionc                 C   s$   | j }dg| }d||< d||< |S )zFGenerate roots with 1 in ith position and -1 in jth position

        r   r   )r   )r   ijr   rootr   r   r   
basic_root   s
   
zTypeF.basic_rootc                 C   sV   |dk r|  |d |S |dkrdgd }d|d< |S |dkr)tddgd }|S dS )a  The ith simple root of F_4

        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("F4")
        >>> c.simple_root(3)
        [0, 0, 0, 1]

           r   r   r   r      N)r   r   )r   r   r   r   r   r   simple_root&   s   
zTypeF.simple_rootc                 C   s  | j }i }d}td|d D ]*}t|d |D ] }|d7 }| ||||< |d7 }| ||}d||< |||< qqtd|D ]}|d7 }dg| }d||< |||< q>|d7 }tddg| }|||< tddD ]}|d7 }tddg| }tdd||< |||< qgtddtddtddtddg||d < tddtddtddtddg||d < tddtddtddtddg||d < tddtddtddtddg||d < |S )a  Generate all the positive roots of A_n

        This is half of all of the roots of F_4; 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   ranger   r   )r   r   posrootskr   r   r   r   r   r   positive_rootsF   s<   



,,,,zTypeF.positive_rootsc                 C   r   )z;
        Returns the total number of roots for F_4
        0   r   r   r   r   r   rootsz      zTypeF.rootsc                 C   s   t ddg d}|S )a'  The Cartan matrix for F_4

        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('A4')
        >>> c.cartan_matrix()
        Matrix([
        [ 2, -1,  0,  0],
        [-1,  2, -1,  0],
        [ 0, -1,  2, -1],
        [ 0,  0, -1,  2]])
        r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   )r   mr   r   r   cartan_matrix   s   zTypeF.cartan_matrixc                 C   r   )zE
        Returns the number of independent generators of F_4
        4   r   r   r   r   r   basis   r!   zTypeF.basisc                 C   s&   d}|d dd tddD 7 }|S )Nz0---0=>=0---0
z   c                 s   s    | ]}t |V  qd S )N)str).0r   r   r   r   	<genexpr>   s    z'TypeF.dynkin_diagram.<locals>.<genexpr>r      )joinr   )r   diagr   r   r   dynkin_diagram   s   zTypeF.dynkin_diagramN)__name__
__module____qualname__r
   r   r   r   r   r    r$   r&   r-   r   r   r   r   r      s     4r   N)cartan_typer   sympy.core.backendr   r   r   r   r   r   r   <module>   s    