
    Qi
                     
   d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
  ed          \  ZZZ edd	          Z ed
d          \  ZZZZd Zd Zd Z G d de
          Z G d de
          Z G d de
          Zd ZdS )    Integer)symbols)Dagger)
Commutator)Operatorza,b,cnT)integerzA,B,C,DF)commutativec                      t          t          t                    } | j        du sJ t	          | t                     sJ |                     t          t                    t          t          t                    k    sJ d S )NF)CommABis_commutative
isinstancesubsC)cs    /var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/sympy/physics/quantum/tests/test_commutator.pytest_commutatorr      sd    Q

Au$$$$a66!Q<<41::%%%%%%    c                  R   t          t          t          z  t          t          z            t          t          z  t          t          t                    z  k    sJ t          t          t                    dk    sJ t          t          t                    dk    sJ t          t          t                    t          t          t                     k    sJ t          t          t                                                    t          t          z  t          t          z  z
  k    sJ t          t          t          t          z                                d          t          t          t                    t          z  t          t          t          t                    z  z   k    sJ t          t          t          z  t          t          z                                d          t          t          z  t          t          t                    z  t          t          t          t                    z  t          z  z   t          t          t          t                    z  t          z  z   t          t          t                    t          z  t          z  z   k    sJ t          t          t          dz                                d          t          t          t                    t          z  t          t          t          t                    z  z   k    sJ t          t          dz  t          dz                                d          t          t          t          z  t          t          z                                d          	                    t          t                    	                    t          t                    cxk    rt          t          z  t          t          t                    z  t          t          t          t                    z  t          z  z   t          t          t          t                    z  t          z  z   t          t          t                    t          z  t          z  z   k    sn J t          t          t          dz                                d          t          t          dt          z  dt          z  z                                d          	                    t          t                    k    sJ t          t          t          z   t          t          z                                 d          t          t          t                    t          t          t                    z   t          t          t                    z   t          t          t                    z   k    sJ t          t          t          t          z                                 d          t          t          t                    t          t          t                    z   k    sJ t          t          t          z  t                                        d          t          t          t          z  t                    k    sJ t          t          t          t          t                              t          t          t          t          t                              z   t          t          t          t          t                              z   } |                                                                 dk    sJ d S )Nr   T
commutator      )r   ar   br   doitr   expandDreplacer	   )es    r   test_commutator_identitiesr%      s   !QqS>>QqSa^++++1::????1::????1::$q!**$$$$1::??!ac	))))1Q3<<$//41::a<!DAJJ,3NNNNN!QqS>>  D 11	!DAJJ41::a'!DAJJ,q.841::a<>IJ J J J1a4==400DAJJqL1T!QZZ<4OOOOO1ad""d"33QqS!A#..66q!<<DDQJJJ J J J	!DAJJ41::a'!DAJJ,q.841::a<>IJ J J J J J 1b5>>  D 11Q1qs##t#44<<QBBC C C CAq1u$$$55Q

T!QZZ$q!**,tAqzz9: : : :1q5>>  D 11T!QZZ$q!**5LLLLL1a==400DAqMMAAAAQQ

d1d1ajj111DDAJJ4G4GGA6688??!!!!!!r   c            	         t          t          t          z  t                    } t	          |                               d          t          t	          t                    t	          t                               t	          t                    z  t	          t                    t          t	          t                    t	          t                              z  z
  k    sJ d S )NTr   )r   r   r   r   r   r!   )comms    r   test_commutator_daggerr(   -   s    !Q<<D$<<$//
vayy&))
$
$$VAYY.q		$vayy&)),,,	-- - - - - -r   c                       e Zd Zd ZdS )Fooc                      t          d          S )Nr   r   )selfbars     r   _eval_commutator_BarzFoo._eval_commutator_Bar6       qzzr   N)__name__
__module____qualname__r.    r   r   r*   r*   4   #            r   r*   c                       e Zd ZdS )BarN)r0   r1   r2   r3   r   r   r6   r6   :   s        Dr   r6   c                       e Zd Zd ZdS )Tamc                      t          d          S )Nr   r   )r,   foos     r   _eval_commutator_FoozTam._eval_commutator_Foo@   r/   r   N)r0   r1   r2   r;   r3   r   r   r8   r8   >   r4   r   r8   c                     t          d          } t          d          }t          d          }t          | |                                          dk    sJ t          ||                                           dk    sJ t          | |                                          dk    sJ t          ||                                           dk    sJ t          ||                                          ||z  ||z  z
  k    sJ t          | dz  |                              d	                                          dk    sJ t          | dz  |                              d	                                          d
| z  k    sJ t          | |dz                                d	                                          d
|z  k    sJ t          |dz  |                               d	                                          d|z  k    sJ t          |dz  | dz                                d	                                          d| z  |z  | z  d| dz  z  |z  z   d|z  | dz  z  z   k    sJ d S )NFr   Tr   r   r   Tr   r      )r*   r6   r8   r   r    r!   )r=   r   r>   s      r   test_eval_commutatorrA   D   sM   CACACA1::??!!!!1::??!!!!1::??""""1::??!!!!1::??!ac	))))1a==40055771<<<<1a==40055772a4????1a4==40055772a4????1a==40055771Q3>>>>1ad""d"3388::ac!eAg!Q$q>PSTUVSVWXZ[W[S[>[[[[[[[r   N)sympy.core.numbersr   sympy.core.symbolr   sympy.physics.quantum.daggerr    sympy.physics.quantum.commutatorr   r   sympy.physics.quantum.operatorr   r   r   r   r	   r   r   r   r"   r   r%   r(   r*   r6   r8   rA   r3   r   r   <module>rG      so   & & & & & & % % % % % % / / / / / / ? ? ? ? ? ? 3 3 3 3 3 3 ''

1aGCWYE222
1a& & &" " "0- - -    (   	 	 	 	 	( 	 	 	    (   \ \ \ \ \r   