def test_wavefunction(): Psi = { 0: (nu/pi)**(S(1)/4) * exp(-nu * x**2 /2), 1: (nu/pi)**(S(1)/4) * sqrt(2*nu) * x * exp(-nu * x**2 /2), 2: (nu/pi)**(S(1)/4) * (2 * nu * x**2 - 1)/sqrt(2) * exp(-nu * x**2 /2), 3: (nu/pi)**(S(1)/4) * sqrt(nu/3) * (2 * nu * x**3 - 3 * x) * exp(-nu * x**2 /2) } for n in Psi: assert simplify(psi_n(n, x, m, omega) - Psi[n]) == 0
def test_orthogonality(n=1): # Maximum "n" which is tested: for i in range(n + 1): for j in range(i + 1, n + 1): assert integrate( psi_n(i, x, 1, 1) * psi_n(j, x, 1, 1), (x, -oo, oo)) == 0
def test_norm(n=1): # Maximum "n" which is tested: for i in range(n + 1): assert integrate(psi_n(i, x, 1, 1)**2, (x, -oo, oo)) == 1
ls_sympy=l # Mismo limites para scipy li_scipy=0 ls_scipy=large if Problem=='Harmonic oscilator': large=0 if W.value=='': omega=1 else: omega=float(eval(W.value)) # Energías del oscilador armónico cuántico En=E_n(n,w) # Funciones de onda del oscilador armónico cuántico Psin=psi_n(n,x,m,w) # Límites del pozo definido de -oo a oo para sympy li_sympy=-oo ls_sympy=oo # Límites del pozo definido de -oo a oo para scipy li_scipy=-inf ls_scipy=inf if Problem=='Hydrogen atom (Helium correction)': if atomic_number.value=='1 (Show Hydrogen energies)': z=1 if atomic_number.value=='2 (Correct Helium first energy)': z=2 large=0 omega=0
def test_orthogonality(n=1): # Maximum "n" which is tested: for i in range(n+1): for j in range(i+1,n+1): assert integrate(psi_n(i, x, 1, 1)*psi_n(j, x, 1, 1), (x,-oo,oo)) == 0
def test_norm(n=1): # Maximum "n" which is tested: for i in range(n+1): assert integrate(psi_n(i, x, 1, 1)**2, (x,-oo,oo)) == 1
from sympy.physics.qho_1d import E_n, psi_n from sympy.physics.sho import E_nl, R_nl from sympy import var var("x m omega") var("r nu l") x, y, z = symbols('x, y, z') E_n(x, omega) psi_n(2, x, m, omega) E_nl(x, y, z) R_nl(1, 0, 1, r) R_nl(2, l, 1, r)