#Variable declaration
rP = 4
rD = 5
LP = 1
LP = 2
jP = (5/2.0, 3/2.0, 1/2.0)
jD = (4, 3, 2, 1)
#Calculation
import math
SP = (rP-1)/2.0
SD = (rD-1)/2.0
i=0
JP=[0,0,0]
JD=[0,0,0,0,0]
for i in range(0,3):
JP[i] =round(math.sqrt(jP[i]*(jP[i])+1) ,2)
i=0
for i in range(0,4):
JD[i] = round(math.sqrt(jD[i]*(jD[i]+1)) ,2)
#Result
print"\nAngular moments allowed for 4P :",JP
print"\nAngular moments allowed for 5D : ",JD
#Variable declaration
l=1
s=1/2.0
j=3/2.0
#calculation
import math
angle=((j*(j+1))-(l*(l+1))-(s*(s+1)))/(2*math.sqrt(l*s*(l+1)*(s+1))) #value of cos θ
#Result
print"\n cos θ = ",round(angle,3)
#Variable declaration
e=1.6*10**-19 #charge of electron (C)
m=9.1*10**-31 #mass of electron (kg)
B=0.1 #external magnetic field (Wb/m**2)
g=4/3.0
mu=9.27*10**-24 #(J/T)
#calculation
from sympy import *
mu_b=Symbol("µb")
import math
E=round(g*B,3)*mu_b #The spacing of adjacent sub-levels (J)
v=(e*B)/(4*math.pi*m) #Larmor frequency (Hz)
#Result
print"\n The spacing of adjacent sub-levels =",E,"J\n Larmor frequency =%.1e"%v,"Hz"
#Variable declaration
mu=9.27*10**-24 #(J/T)
g=2
ms=1/2.0
dB=2*10**2 #gradient of magnetic field (T/m)
m=1.67*10**-27 #maas of hydrogen atom (kg)
l=0.2 #distance travelled by hydrogen atom (m)
v=2*10**5 #speed of hydrogen atom (m/s)
#calculation
muz=g*mu*ms #Resolved part of magnetic moment in the direction of magnetic field (J/T)
Fz=muz*dB #Force on the atom (N)
z=0.5*(Fz/m)*(l/v)**2 #Displacement of beam (m)
sep=2*z #Total separation (m)
#Result
print"\n Total separation =%.2e"%sep,"m"
#Variable declaration
l=1.0
s=1.0/2.0
j1=1.0/2.0
j2=3.0/2.0
#calculation
import math
L=math.sqrt(l*(l+1.0)) #orbital angular momenta
S=math.sqrt(s*(s+1.0)) #spin angular momenta
J1=math.sqrt(j1*(j1+1.0)) #total angular momenta
J2=math.sqrt(j2*(j2+1.0)) #total angular momenta
theta1=(180.0/math.pi)*math.acos(((j2*(j2+1))-(l*(l+1))-(s*(s+1)))/(2.0*math.sqrt(l*(l+1.0))*math.sqrt(s*(s+1)))) #angle b/w l and s (degree)
theta2=(180.0/math.pi)*math.acos(((j1*(j1+1))-(l*(l+1))-(s*(s+1)))/(2.0*math.sqrt(l*(l+1.0))*math.sqrt(s*(s+1)))) #angle b/w l and s (degree)
#Result
print"\n |l| =",round(L,2),"*h=√2h\n |s| =",round(S,2),"*h=√3/4 h\n |j| =",round(J1,2),"*h=√3/4 h,",round(J2,2),"*h=√15/4 h\n θ1 =%d"%theta1,"˚\n θ2 =%d"%round(theta2),"˚"
#Variable declaration
B=0.5 #magnetic field (T)
s=1/2.0
g=2
#calculation
import math
from sympy import *
mu_B=Symbol("μβ")
S=math.sqrt(s*(s+1)) #Magnitude of spin vector
theta1=(180.0/math.pi)*math.acos(0.5/S) #Orientation of spin vector (degree)
theta2=(180.0/math.pi)*math.acos(-0.5/S) #Orientation of spin vector (degree)
E=2*g*mu_B*B #Separation of the energy levels (in terms of μβ)
#Result
print"θ =",round(theta1,1),"˚ and θ=",round(theta2,1),"˚\n ΔE =",E
#Variable declaration
zH=1.0 #atomic no. of H
zHe=2.0 #atomic no. of He
deltaHe=5.84 #doublet splitting of the first excited state of He (cm-1)
#calculation
deltaH=deltaHe*(zH/zHe)**4 #doublet splitting for hydrogen atom (cm-1)
#Result
print"Doublet splitting for H atom =",deltaH,"cm**-1"
#Variable declaration
z=1 #atomic no. of hydrogen atom
n=2
l=1
#calculation
delta=(5.84*z**4)/(n**3*l*(l+1)) #spin-orbit interaction splitting (cm-1)
#Result
print"Spin-orbit interaction splitting =",delta,"cm**-1"