
    \h                         S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr  SS	 jrSS
 jrSS jrSS\" S5      4S jrg)    )Float)S)	factorial)exp)sqrt)assoc_laguerre)Ynm   c                 B   [        [        XX#/5      u  pp#X-
  S-
  nSU-  nSU-  X-  -  n[        [        S5      X-  -  S-  [        U5      -  SU -  [        X-   5      -  -  5      nXvU-  -  [	        USU-  S-   U5      R                  5       -  [        U* S-  5      -  $ )a  
Returns the Hydrogen radial wavefunction R_{nl}.

Parameters
==========

n : integer
    Principal Quantum Number which is
    an integer with possible values as 1, 2, 3, 4,...
l : integer
    ``l`` is the Angular Momentum Quantum Number with
    values ranging from 0 to ``n-1``.
r :
    Radial coordinate.
Z :
    Atomic number (1 for Hydrogen, 2 for Helium, ...)

Everything is in Hartree atomic units.

Examples
========

>>> from sympy.physics.hydrogen import R_nl
>>> from sympy.abc import r, Z
>>> R_nl(1, 0, r, Z)
2*sqrt(Z**3)*exp(-Z*r)
>>> R_nl(2, 0, r, Z)
sqrt(2)*(-Z*r + 2)*sqrt(Z**3)*exp(-Z*r/2)/4
>>> R_nl(2, 1, r, Z)
sqrt(6)*Z*r*sqrt(Z**3)*exp(-Z*r/2)/12

For Hydrogen atom, you can just use the default value of Z=1:

>>> R_nl(1, 0, r)
2*exp(-r)
>>> R_nl(2, 0, r)
sqrt(2)*(2 - r)*exp(-r/2)/4
>>> R_nl(3, 0, r)
2*sqrt(3)*(2*r**2/9 - 2*r + 3)*exp(-r/3)/27

For Silver atom, you would use Z=47:

>>> R_nl(1, 0, r, Z=47)
94*sqrt(47)*exp(-47*r)
>>> R_nl(2, 0, r, Z=47)
47*sqrt(94)*(2 - 47*r)*exp(-47*r/2)/4
>>> R_nl(3, 0, r, Z=47)
94*sqrt(141)*(4418*r**2/9 - 94*r + 3)*exp(-47*r/3)/27

The normalization of the radial wavefunction is:

>>> from sympy import integrate, oo
>>> integrate(R_nl(1, 0, r)**2 * r**2, (r, 0, oo))
1
>>> integrate(R_nl(2, 0, r)**2 * r**2, (r, 0, oo))
1
>>> integrate(R_nl(2, 1, r)**2 * r**2, (r, 0, oo))
1

It holds for any atomic number:

>>> integrate(R_nl(1, 0, r, Z=2)**2 * r**2, (r, 0, oo))
1
>>> integrate(R_nl(2, 0, r, Z=3)**2 * r**2, (r, 0, oo))
1
>>> integrate(R_nl(2, 1, r, Z=4)**2 * r**2, (r, 0, oo))
1

r
         )mapr   r   r   r   expandr   )nlrZn_rar0Cs           N/var/www/auris/envauris/lib/python3.13/site-packages/sympy/physics/hydrogen.pyR_nlr   
   s    N Qq%JA!
%!)C	!A	
Q!%BadACj1_y~-1Yqu5E1EFGA 1u9~c1Q37B7>>@@3s1u:MM    c           
      \   [        [        XX#XEU/5      u  pp#pEnU R                  (       a  U S:  a  [        S5      eUR                  (       a  X:  d  [        S5      eUR                  (       a  [	        U5      U::  d  [        S5      e[        XX65      [        XXT5      R                  SS9-  $ )a  
Returns the Hydrogen wave function psi_{nlm}. It's the product of
the radial wavefunction R_{nl} and the spherical harmonic Y_{l}^{m}.

Parameters
==========

n : integer
    Principal Quantum Number which is
    an integer with possible values as 1, 2, 3, 4,...
l : integer
    ``l`` is the Angular Momentum Quantum Number with
    values ranging from 0 to ``n-1``.
m : integer
    ``m`` is the Magnetic Quantum Number with values
    ranging from ``-l`` to ``l``.
r :
    radial coordinate
phi :
    azimuthal angle
theta :
    polar angle
Z :
    atomic number (1 for Hydrogen, 2 for Helium, ...)

Everything is in Hartree atomic units.

Examples
========

>>> from sympy.physics.hydrogen import Psi_nlm
>>> from sympy import Symbol
>>> r=Symbol("r", positive=True)
>>> phi=Symbol("phi", real=True)
>>> theta=Symbol("theta", real=True)
>>> Z=Symbol("Z", positive=True, integer=True, nonzero=True)
>>> Psi_nlm(1,0,0,r,phi,theta,Z)
Z**(3/2)*exp(-Z*r)/sqrt(pi)
>>> Psi_nlm(2,1,1,r,phi,theta,Z)
-Z**(5/2)*r*exp(I*phi)*exp(-Z*r/2)*sin(theta)/(8*sqrt(pi))

Integrating the absolute square of a hydrogen wavefunction psi_{nlm}
over the whole space leads 1.

The normalization of the hydrogen wavefunctions Psi_nlm is:

>>> from sympy import integrate, conjugate, pi, oo, sin
>>> wf=Psi_nlm(2,1,1,r,phi,theta,Z)
>>> abs_sqrd=wf*conjugate(wf)
>>> jacobi=r**2*sin(theta)
>>> integrate(abs_sqrd*jacobi, (r,0,oo), (phi,0,2*pi), (theta,0,pi))
1
r
   'n' must be positive integer'n' must be greater than 'l'z|'m'| must be less or equal 'l'T)func)r   r   
is_integer
ValueErrorabsr   r	   r   )r   r   mr   phithetar   s          r   Psi_nlmr%   _   s    p !$AaC'B CA!A||A788||QU788||SVq[:;;aCe188d8CCCr   c                     [        U 5      [        U5      pU R                  (       a  U S:  a  [        S5      eUS-  * SU S-  -  -  $ )a  
Returns the energy of the state (n, l) in Hartree atomic units.

The energy does not depend on "l".

Parameters
==========

n : integer
    Principal Quantum Number which is
    an integer with possible values as 1, 2, 3, 4,...
Z :
    Atomic number (1 for Hydrogen, 2 for Helium, ...)

Examples
========

>>> from sympy.physics.hydrogen import E_nl
>>> from sympy.abc import n, Z
>>> E_nl(n, Z)
-Z**2/(2*n**2)
>>> E_nl(1)
-1/2
>>> E_nl(2)
-1/8
>>> E_nl(3)
-1/18
>>> E_nl(3, 47)
-2209/18

r
   r   r   )r   r   r    )r   r   s     r   E_nlr'      sE    @ Q41q||Q788qD5!AqD&>r   Tz137.035999037c                 L   [        [        XX4/5      u  pp4US:  d  [        S5      eX:  d  [        S5      eUS:X  a  USL a  [        S5      eU(       a  U* S-
  nOU* n[        US-  US-  US-  -  -
  5      nUS-  [        SUS-  X-   U-   S-  -  US-  -  -   5      -  US-  -
  $ )a[  
Returns the relativistic energy of the state (n, l, spin) in Hartree atomic
units.

The energy is calculated from the Dirac equation. The rest mass energy is
*not* included.

Parameters
==========

n : integer
    Principal Quantum Number which is
    an integer with possible values as 1, 2, 3, 4,...
l : integer
    ``l`` is the Angular Momentum Quantum Number with
    values ranging from 0 to ``n-1``.
spin_up :
    True if the electron spin is up (default), otherwise down
Z :
    Atomic number (1 for Hydrogen, 2 for Helium, ...)
c :
    Speed of light in atomic units. Default value is 137.035999037,
    taken from https://arxiv.org/abs/1012.3627

Examples
========

>>> from sympy.physics.hydrogen import E_nl_dirac
>>> E_nl_dirac(1, 0)
-0.500006656595360

>>> E_nl_dirac(2, 0)
-0.125002080189006
>>> E_nl_dirac(2, 1)
-0.125000416028342
>>> E_nl_dirac(2, 1, False)
-0.125002080189006

>>> E_nl_dirac(3, 0)
-0.0555562951740285
>>> E_nl_dirac(3, 1)
-0.0555558020932949
>>> E_nl_dirac(3, 1, False)
-0.0555562951740285
>>> E_nl_dirac(3, 2)
-0.0555556377366884
>>> E_nl_dirac(3, 2, False)
-0.0555558020932949

r   z'l' must be positive or zeror   FzSpin must be up for l==0.r
   r   )r   r   r    r   )r   r   spin_upr   cskappabetas          r   
E_nl_diracr-      s    f Qq%JA!F788E788	Q7e#455a	AqDAI%&Da4QAqzD0144QT99::QTAAr   N)r
   )sympy.core.numbersr   sympy.core.singletonr   (sympy.functions.combinatorial.factorialsr   &sympy.functions.elementary.exponentialr   (sympy.functions.elementary.miscellaneousr   #sympy.functions.special.polynomialsr   +sympy.functions.special.spherical_harmonicsr	   r   r%   r'   r-    r   r   <module>r6      sE    $ " > 6 9 > ;RNjADH#L "Q%*@ @Br   