# Chapter 7: The Hydrogen Atom¶

## Example 7.2, Page 248¶

In :
import scipy
import math

#Variable declaration
a0 = 1;    # For simplicity assume Bohr radius to be unity, m

#Calculations&Results
x = lambda r:r**4*math.exp(-r/a0)
y = lambda t:math.sin(t)**3
z = lambda p:p**0
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"

NE = 1
The hydrogen wave function is normalized


## Example 7.4, Page 252¶

In :
#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);

n    l    m_l               2(l + 1)

------------------------------------

3     0      0                    1
3     1     -1   0   1               3
3     2     -2  -1   0   1   2         5
Total = 9


## Example 7.7, Page 256¶

In :
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

The value of Bohr magneton = 9.26e-24 J/T
The energy difference between components of p states of atomic hydrogen placed in the external field = 1.16e-04 eV


## Example 7.8, Page 257¶

In :
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
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)

The separation of the atomic beam = 0.19 mm


## Example 7.9, Page 259¶

In :
#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

n    l         m_l             m_s

------------------------------------------
-2             +1./2, -1./2
-1             +1./2, -1./2
4	 2      0             +1./2, -1./2
1             +1./2, -1./2
2             +1./2, -1./2
Total No. of different states for 4d level of atomic hydrogen = 10


## Example 7.10, Page 263¶

In :
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] - state[i+1];
d_l = state[i] - state[i+1];
d_m_l = state[i] - state[i+1];
d_m_s = state[i] - state[i+1];
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], state[i], state[i], state[i]*4, state[i+1], state[i+1], state[i+1], state[i+1]*4))
delta_E = -13.6*(1./state[i+1]**2-1./state[i]**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], state[i], state[i], state[i], state[i+1], state[i+1], state[i+1], state[i+1]))


The transition (2,0,0,1/2) --> (3,1,1,1/2) is allowed
The energy of this transition is 1.89 eV

The transition (2,0,0, 0)--> (3,0,0,0) is not allowed

The transition (4,2,-1,1/-2) --> (2,1,0,1/2) is allowed
The energy of this transition is -2.55 eV


## Example 7.13, Page 266¶

In :
import scipy
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

The probability of the electron in the 1s state of the hydrogen atom = 0.68