In [5]:

```
#L-S coupling for two electrons
# For 2D(3/2) state
l2 = 1 # Orbital quantum number for p state
l1 = 1 # Orbital quantum number for p state
print "The values of orbital quantum number L, for l1 = %d and l2 = %d are: "%(l1, l2)
for L in range(l2-l1,l2+l1+1,1):
print "%d "% L,
```

In [18]:

```
#Term values for L-S coupling
# For 2D(3/2) state
# Set-I values of L and S
L = 1 # Orbital quantum number
S = 1.0/2 # Spin quantum number
print "The term values for L = %d and S = %2.1f (P-state) are:"%(L, S)
J1 = 3.0/2 # Total quantum number
print "%dP(%2.1f)\t"% (2*S+1,J1),
J2 = 1.0/2 # Total quantum number
print "%dP(%2.1f)"% (2*S+1,J2)
# Set-II values of L and S
L = 2 # Orbital quantum number
S = 1.0/2 # Spin quantum number
print "The term values for L = %d and S = %2.1f (P-state) are:"%(L, S)
J1 = 5.0/2 # Total quantum number
print "%dD(%2.1f)\t"% (2*S+1,J1),
J2 = 3.0/2 # Total quantum number
print "%dD(%2.1f)"% (2*S+1,J2)
```

In [20]:

```
from math import acos, degrees, sqrt
#Angle between l and s for 2D(3/2) state
# For 2D(3/2) state
l = 2.0 # Orbital quantum number
s = 1.0/2 # Spin quantum number
j = l+s # Total quantum number
# Now by cosine rule of L-S coupling
# cos(theta) = (j*(j+1)-l*(l+1)-s*(s+1))/(2*sqrt(s*(s+1))*sqrt(l*(l+1))), solving for theta
theta = degrees(acos((l*(l+1)+s*(s+1)-j*(j+1))/(2*sqrt(s*(s+1))*sqrt(l*(l+1))))) # Angle between l and s for 2D(3/2) state
print "The angle between l and s for 2D(3/2) state = %5.1f degrees"% theta
```