| 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�z � @ s� d Z ddlmZmZmZmZmZmZmZm Z m
Z
mZmZm
Z
mZmZmZmZmZmZ dgZdd� Zdd� Zdd � Zddd�Zdd
d�Zddd�Zddd�Zddd�ZG dd� de�Zdd� Zdd� Zdd� Z d
S )a
Wigner, Clebsch-Gordan, Racah, and Gaunt coefficients
Collection of functions for calculating Wigner 3j, 6j, 9j,
Clebsch-Gordan, Racah as well as Gaunt coefficients exactly, all
evaluating to a rational number times the square root of a rational
number [Rasch03]_.
Please see the description of the individual functions for further
details and examples.
References
==========
.. [Regge58] 'Symmetry Properties of Clebsch-Gordan Coefficients',
T. Regge, Nuovo Cimento, Volume 10, pp. 544 (1958)
.. [Regge59] 'Symmetry Properties of Racah Coefficients',
T. Regge, Nuovo Cimento, Volume 11, pp. 116 (1959)
.. [Edmonds74] A. R. Edmonds. Angular momentum in quantum mechanics.
Investigations in physics, 4.; Investigations in physics, no. 4.
Princeton, N.J., Princeton University Press, 1957.
.. [Rasch03] J. Rasch and A. C. H. Yu, 'Efficient Storage Scheme for
Pre-calculated Wigner 3j, 6j and Gaunt Coefficients', SIAM
J. Sci. Comput. Volume 25, Issue 4, pp. 1416-1428 (2003)
.. [Liberatodebrito82] 'FORTRAN program for the integral of three
spherical harmonics', A. Liberato de Brito,
Comput. Phys. Commun., Volume 25, pp. 81-85 (1982)
Credits and Copyright
=====================
This code was taken from Sage with the permission of all authors:
https://groups.google.com/forum/#!topic/sage-devel/M4NZdu-7O38
Authors
=======
- Jens Rasch (2009-03-24): initial version for Sage
- Jens Rasch (2009-05-31): updated to sage-4.0
- Oscar Gerardo Lazo Arjona (2017-06-18): added Wigner D matrices
Copyright (C) 2008 Jens Rasch <jyr2000@gmail.com>
� )�Integer�pi�sqrt�sympify�Dummy�S�Sum�Ynm�zeros�Function�sin�cos�exp�I� factorial�binomial�Add�ImmutableMatrix� c C sR | t t�krtt t�t| d ��D ]
}t�t|d | � qtdt| �d � S )a1
Function calculates a list of precomputed factorials in order to
massively accelerate future calculations of the various
coefficients.
Parameters
==========
nn : integer
Highest factorial to be computed.
Returns
=======
list of integers :
The list of precomputed factorials.
Examples
========
Calculate list of factorials::
sage: from sage.functions.wigner import _calc_factlist
sage: _calc_factlist(10)
[1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800]
r N)�len� _Factlist�range�int�append)�nn�ii� r �6/usr/lib/python3/dist-packages/sympy/physics/wigner.py�_calc_factlist: s r c C sB t | d �| d kst |d �|d kst |d �|d kr"td��t |d �|d ks@t |d �|d ks@t |d �|d krDtd��|| | dkrNdS tdt | | | � �}| }| | | }|dk ridS | | | }|dk rudS | | | } | dk r�dS t|�| ks�t|�|ks�t|�|kr�dS t| | | d | t|� |t|� |t|� �}
tt |
�� ttt | | | � tt | | | � tt | | | � tt | | � tt | | � tt || � tt || � tt || � tt || � �tt | | | d � }t|�}|j�s|j �r$|�
� d }t| | | | | | d�}
t|| | | | | | �}d}tt |
�t |�d �D ]I}t| tt || | | � tt || | � tt | | | � tt || | | � tt | | | | � }|td| �| }�qO|| | }|S )a�
Calculate the Wigner 3j symbol `\operatorname{Wigner3j}(j_1,j_2,j_3,m_1,m_2,m_3)`.
Parameters
==========
j_1, j_2, j_3, m_1, m_2, m_3 :
Integer or half integer.
Returns
=======
Rational number times the square root of a rational number.
Examples
========
>>> from sympy.physics.wigner import wigner_3j
>>> wigner_3j(2, 6, 4, 0, 0, 0)
sqrt(715)/143
>>> wigner_3j(2, 6, 4, 0, 0, 1)
0
It is an error to have arguments that are not integer or half
integer values::
sage: wigner_3j(2.1, 6, 4, 0, 0, 0)
Traceback (most recent call last):
...
ValueError: j values must be integer or half integer
sage: wigner_3j(2, 6, 4, 1, 0, -1.1)
Traceback (most recent call last):
...
ValueError: m values must be integer or half integer
Notes
=====
The Wigner 3j symbol obeys the following symmetry rules:
- invariant under any permutation of the columns (with the
exception of a sign change where `J:=j_1+j_2+j_3`):
.. math::
\begin{aligned}
\operatorname{Wigner3j}(j_1,j_2,j_3,m_1,m_2,m_3)
&=\operatorname{Wigner3j}(j_3,j_1,j_2,m_3,m_1,m_2) \\
&=\operatorname{Wigner3j}(j_2,j_3,j_1,m_2,m_3,m_1) \\
&=(-1)^J \operatorname{Wigner3j}(j_3,j_2,j_1,m_3,m_2,m_1) \\
&=(-1)^J \operatorname{Wigner3j}(j_1,j_3,j_2,m_1,m_3,m_2) \\
&=(-1)^J \operatorname{Wigner3j}(j_2,j_1,j_3,m_2,m_1,m_3)
\end{aligned}
- invariant under space inflection, i.e.
.. math::
\operatorname{Wigner3j}(j_1,j_2,j_3,m_1,m_2,m_3)
=(-1)^J \operatorname{Wigner3j}(j_1,j_2,j_3,-m_1,-m_2,-m_3)
- symmetric with respect to the 72 additional symmetries based on
the work by [Regge58]_
- zero for `j_1`, `j_2`, `j_3` not fulfilling triangle relation
- zero for `m_1 + m_2 + m_3 \neq 0`
- zero for violating any one of the conditions
`j_1 \ge |m_1|`, `j_2 \ge |m_2|`, `j_3 \ge |m_3|`
Algorithm
=========
This function uses the algorithm of [Edmonds74]_ to calculate the
value of the 3j symbol exactly. Note that the formula contains
alternating sums over large factorials and is therefore unsuitable
for finite precision arithmetic and only useful for a computer
algebra system [Rasch03]_.
Authors
=======
- Jens Rasch (2009-03-24): initial version
� z(j values must be integer or half integerz(m values must be integer or half integerr ���r )
r �
ValueErrorr �abs�maxr r r �
is_complex�is_infinite�as_real_imag�minr )�j_1�j_2�j_3�m_1�m_2�m_3�prefid�a1�a2�a3�maxfact�argsqrt�ressqrt�imin�imax�sumresr �den�resr r r � wigner_3j[ s� (V($$
��������� � �����r: c C s<