import math
#Variable declaration
delta_E = 0.0021; # Energy difference for the 3p subshell of sodium, eV
h = 6.62e-034; # Planck's constant, Js
h_bar = h/(2*math.pi); # Reduced Planck's constant, Js
e = 1.602e-019; # Energy equivalent of 1 eV, J
m = 9.11e-031; # Rest of an an electron, kg
g_s = 2; # Gyromagnetic ratio due to spin splitting
#Calculations
# As delta_E = g_s*e*h_bar/(2*m)*B, solving for B
B = m*delta_E/h_bar; # Internal magnetic field causing the LS splitting, T
#Result
print "The internal magnetic field causing the LS splitting = %2d T"%B
import numpy
l1 = 1; # Orbital angular momentum quantum number for first electron
l2 = 2; # Orbital angular momentum quantum number for second electron
s1 = 1./2; # Spin angular momentum quantum number for first electron
s2 = 1./2; # Spin angular momentum quantum number for second electron
temp_j = numpy.zeros(15);
cnt = 0;
print ("\nThe all possibe values of the total angular momentum quantum number of J are:");
for L in range(int(abs(l1 - l2)),int(abs(l1 + l2))+1):
for S in range(int(abs(s1 - s2)),int(abs(s1 + s2))+1):
for j in range(abs(L - S),abs(L + S)+1):
temp_j[cnt] = j;
cnt = cnt + 1;
J = -1;
temp_J = sorted(temp_j)
for i in range(len(temp_J)):
if temp_J[i] > J:
J = temp_J[i];
print "%d "%temp_J[i],;
import math
#Variable declaration
delta_E = 0.0021; # Energy difference for the 3p subshell of sodium, eV
h = 6.62e-034; # Planck's constant, Js
h_bar = h/(2*math.pi); # Reduced Planck's constant, Js
e = 1.602e-019; # Energy equivalent of 1 eV, J
m = 9.11e-031; # Rest of an an electron, kg
g_s = 2; # Gyromagnetic ratio due to spin splitting
#Calculations
# As delta_E = g_s*e*h_bar/(2*m)*B, solving for B
B = m*delta_E/h_bar; # Internal magnetic field causing the LS splitting, T
#Result
print "The internal magnetic field causing the LS splitting = %2d T"%B