| Server IP : 93.86.61.54 / Your IP : 216.73.216.206 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/sympy/physics/__pycache__/ |
Upload File : |
o
�8Va � @ s^ d Z ddlmZmZmZmZmZ ddlmZ dgZ dd� Z
dd� ZG d d
� d
e�Zdd� Z
dS )
a
This module implements Pauli algebra by subclassing Symbol. Only algebraic
properties of Pauli matrices are used (we don't use the Matrix class).
See the documentation to the class Pauli for examples.
References
==========
.. [1] https://en.wikipedia.org/wiki/Pauli_matrices
� )�Symbol�I�Mul�Pow�Add)�
TensorProduct�evaluate_pauli_productc C s | |krdS dS )z�
Returns 1 if ``i == j``, else 0.
This is used in the multiplication of Pauli matrices.
Examples
========
>>> from sympy.physics.paulialgebra import delta
>>> delta(1, 1)
1
>>> delta(2, 3)
0
� r � )�i�jr
r
�</usr/lib/python3/dist-packages/sympy/physics/paulialgebra.py�delta s r c C s( | ||fdv r dS | ||fdv rdS dS )ak
Return 1 if i,j,k is equal to (1,2,3), (2,3,1), or (3,1,2);
-1 if ``i``,``j``,``k`` is equal to (1,3,2), (3,2,1), or (2,1,3);
else return 0.
This is used in the multiplication of Pauli matrices.
Examples
========
>>> from sympy.physics.paulialgebra import epsilon
>>> epsilon(1, 2, 3)
1
>>> epsilon(1, 3, 2)
-1
)�r � � )r r r )r r r r ))r r r )r r r )r r r ���r r
)r r �kr
r
r
�epsilon( s
r c sJ e Zd ZdZdZddd�Zdd� Zdd � Z� fd
d�Z� fdd
�Z � Z
S )�Paulia�
The class representing algebraic properties of Pauli matrices.
Explanation
===========
The symbol used to display the Pauli matrices can be changed with an
optional parameter ``label="sigma"``. Pauli matrices with different
``label`` attributes cannot multiply together.
If the left multiplication of symbol or number with Pauli matrix is needed,
please use parentheses to separate Pauli and symbolic multiplication
(for example: 2*I*(Pauli(3)*Pauli(2))).
Another variant is to use evaluate_pauli_product function to evaluate
the product of Pauli matrices and other symbols (with commutative
multiply rules).
See Also
========
evaluate_pauli_product
Examples
========
>>> from sympy.physics.paulialgebra import Pauli
>>> Pauli(1)
sigma1
>>> Pauli(1)*Pauli(2)
I*sigma3
>>> Pauli(1)*Pauli(1)
1
>>> Pauli(3)**4
1
>>> Pauli(1)*Pauli(2)*Pauli(3)
I
>>> from sympy.physics.paulialgebra import Pauli
>>> Pauli(1, label="tau")
tau1
>>> Pauli(1)*Pauli(2, label="tau")
sigma1*tau2
>>> Pauli(1, label="tau")*Pauli(2, label="tau")
I*tau3
>>> from sympy import I
>>> I*(Pauli(2)*Pauli(3))
-sigma1
>>> from sympy.physics.paulialgebra import evaluate_pauli_product
>>> f = I*Pauli(2)*Pauli(3)
>>> f
I*sigma2*sigma3
>>> evaluate_pauli_product(f)
-sigma1
�r �label�sigmac C s: |dvrt d��tj| d||f ddd�}||_||_|S )Nr zInvalid Pauli indexz%s%dFT)�commutative� hermitian)�
IndexErrorr �__new__r r )�clsr r �objr
r
r
r ~ s z
Pauli.__new__c C s | j | jfi fS �Nr ��selfr
r
r
�__getnewargs_ex__� s zPauli.__getnewargs_ex__c C s | j | jfS r r r r
r
r
�_hashable_content� s zPauli._hashable_contentc s� t |t�rA| j}|j}| j}|j}||krAt||�tt||d� td|� tt||d� td|� tt||d� td|� S t� �|�S )Nr r r ) �
isinstancer r r r r r �super�__mul__)r! �otherr r �jlab�klab�� __class__r
r
r&