import scipy
import math
from scipy.integrate import quad
#Variable declaration
a0 = 1; # For simplicity assume Bohr radius to be unity, m
#Calculations&Results
x = lambda r:r**4*math.exp(-r/a0)
int1,err = scipy.integrate.quad(x,0,15)
y = lambda t:math.sin(t)**3
int2,err = scipy.integrate.quad(y,0,math.pi)
z = lambda p:p**0
int3,err = scipy.integrate.quad(z,0,2*math.pi)
NE = 1./(64*math.pi*a0**5)*int1*int2*int3;
print "NE = %.f"%NE
if round(NE) == 1:
print "The hydrogen wave function is normalized"
else:
print "The hydrogen wave function is not normalized"
#Variable declaration
n = 3; # Principal quantum number
#Calculations&Results
Total = 0;
print ("\nn l m_l 2(l + 1)");
print ("\n------------------------------------");
for l in range(0,n):
print ("\n%d"% n),
print (" %d "% l),
if l > 0:
count = 0;
for m_l in range(-l,l+1):
print ("%2d "% m_l),
count = count + 1;
if l == 1:
print(" "),
else:
print(""),
else :
m_l = 0;
count = 0;
print("%2d "% m_l),
count = count + 1;
print(" %d"% count),
Total = Total + count;
print("\n Total = %d"% Total);
import math
#Variable declaration
e = 1.602e-019; # Charge on an electron, C
h = 6.62e-034; # Planck's constant, Js
h_bar = h/(2*math.pi); # Reduced Planck's constant, Js
m = 9.11e-031; # Electron mass, kg
B = 2.00; # External magnetic field, T
m_l1 = 0; # Lower orbital magnetic quantum number
m_l2 = 1; # Upper orbital magnetic quantum number
#Calculations
delta_m_l = m_l2 - m_l1; # Change in m_l
mu_B = e*h_bar/(2*m); # Bohr's magneton, J/T
delta_E = mu_B*B*delta_m_l/e; # Energy difference between components of p states of atomic hydrogen placed in the external field, eV
#Results
print "The value of Bohr magneton = %4.2e J/T"%mu_B
print "The energy difference between components of p states of atomic hydrogen placed in the external field = %4.2e eV"%delta_E
import math
#Variable declaration
m = 1.67e-027; # Mass of the proton, kg
k = 1.38e-023; # Boltzmann constant, J/K
T = 663; # Temperature of the discharge tube, K
#Calculations
v_x = math.sqrt(3*k*T/m); # Average speed of the hydrogen atom
mu_z = 9.27e-024; # Bohr's magneton, J/T
B_grad = 1240; # Magnetic field gradient, T/m
delta_x = 0.03; # Length of the homogeneous magnetic field, m
d = 1/(2*m)*(mu_z*B_grad)*(delta_x/v_x)**2; # Separation of the atomic beam, m
#Result
print "The separation of the atomic beam = %4.2f mm"%(d/1e-003)
#Variable declaration
n = 4; # Principal quantum number
l = 2; # For 4d-state
#Calculations&Results
print "\nn l m_l m_s"
print "\n------------------------------------------"
count = 0;
for m_l in range(-l,3):
if (m_l == 0):
print "%d\t"%n,
print " %d"%l,
print " %d "%m_l,
print " +1./2, -1./2"
else:
print " %2d"%m_l,
print " +1./2, -1./2"
count = count + 2;
print "Total No. of different states for 4d level of atomic hydrogen = %d"%count
def check_allowance(dn, dl, dml, dms):
if (dl == -1 or dl == 1 or dml == -1 or dml == 0 or dml == 1 or dms == -1 or dms == 0 or dms == 1) and dl != 0:
return 1;
else:
return 0;
state = [[2, 0, 0, 1./2],[ 3, 1, 1, 1./2],[ 2, 0, 0, 1./2],[ 3, 0, 0, 1./2],[ 4, 2, -1, -1./2],[ 2, 1, 0, 1./2]];
for i in range(0,5,2):
flag = 0;
d_n = state[i][0] - state[i+1][0];
d_l = state[i][1] - state[i+1][1];
d_m_l = state[i][2] - state[i+1][2];
d_m_s = state[i][3] - state[i+1][3];
flag = check_allowance(d_n, d_l, d_m_l, d_m_s);
if flag == 1:
print("\n\nThe transition (%d,%d,%d,1/%d) --> (%d,%d,%d,1/%d) is allowed"%( state[i][0], state[i][1], state[i][2], state[i][3]*4, state[i+1][0], state[i+1][1], state[i+1][2], state[i+1][3]*4))
delta_E = -13.6*(1./state[i+1][0]**2-1./state[i][0]**2);
print("The energy of this transition is %4.2f eV"% delta_E);
else:
print("\n\nThe transition (%d,%d,%d, %d)--> (%d,%d,%d,%d) is not allowed"%(state[i][0], state[i][1], state[i][2], state[i][3], state[i+1][0], state[i+1][1], state[i+1][2], state[i+1][3]))
import scipy
from scipy.integrate import quad
import math
#Variable declaration
a0 = 1; # For simplicity assume bohr radius to be unity
#Calculations
p = lambda r: 4/a0**3*math.exp(-2*r/a0)*r**2
P,err = scipy.integrate.quad(p, a0, 10);
#Result
print "The probability of the electron in the 1s state of the hydrogen atom = %4.2f"%P