In [1]:

```
# Given
lambda_val = 450*10**-9 # in nm
h = 6.6*10**-34 # in J s
e = 1.6*10**-19 # in coulombs
c = 3*10**8 # in m/s
# Calculations and Results
E_ph = h*c/lambda_val # in J
E_ph /= e # in eV
print(" Energy of blue photon in eV is {0:.4f}".format(E_ph))
```

In [2]:

```
# Given
lambda_o = 522*10**-9 # in nm
lambda_val = 250*10**-9 # in nm
h = 6.6*10**-34 # in J s
c = 3*10**8 # in m/s
e = 1.6*10**-19 # in coulombs
I = 20*10**-3 # in W/cm2
I = 20*10**-3*10**4 # in J/s/m2
# Calculations and Results
# part(a)
phi = h*c/(lambda_o*e) # in eV
print("Work function of sodium in eV is {0:.4f}".format(phi))
KE = h*c/(lambda_val*e)-phi
print("Kinetic energy of photo emitted electrons in eV is {0:.4f}".format(KE))
J = (e*I*lambda_val)/(h*c)
print("Photoelectric current density in A/m2 is {0:.4f}".format(J))
```

In [3]:

```
import math
# Given
theta = 15.2 # in degree
d = 0.234 # in nm
V = 100.0 # in V
# Calculations and Results
lambda_val = 2*d*math.sin(math.radians(theta)) # Braggs condition
print("Wavelength of electron in nm is {0:.4f}".format(lambda_val))
lambda_val = 1.226/math.sqrt(V) # debroglie wavelength in nm
print("de Broglie Wavelength of electron in nm is {0:.4f}".format(lambda_val))
print("de Broglie Wavelength is in excellent agreement with that determined from Braggs condition")
```

In [4]:

```
# Given
h = 6.6*10**-34 # in J s
c = 3*10**8 # in m/s
n = 1.0
m = 9.1*10**-31 # in Kg
a = 0.1*10**-9 # in m
e = 1.6*10**-19 # in coulombs
# Calculations and Results
E1 = (h**2*n**2)/(8*m*a**2)
E1 /= e # in eV
print("Ground Energy of the electron in J is {0:.4f}".format(E1))
# part(b)
n = 3.0
E3 = E1*n**2
print("Energy required to put the electrons in third energy level in eV is {0:.4f}".format(E3))
E = E3-E1
print("Energy required to take the electron from E1 to E3 in eV is {0:.4f}".format(E))
lambda_val = h*c/(E*e)
print("wavelength of the required photon in nm is {0:.4g}".format(lambda_val))
print("which is an X-ray photon")
```

In [5]:

```
import math
# Given
h = 6.6*10**-34 # in J s
c = 3*10**8 # in m/s
n = 1.0
m = 0.1 # in Kg
a = 1.0 # in m
# Calculations and Results
E1 = (h**2*n**2)/(8*m*a**2)
v = math.sqrt(2*E1/m)
print("Minimum speed of the object in m/s {0:.4g}".format(v))
# calculation of quantum number n
v = 1.0 # in m/s
E_n = m*v**2/2.0
n = math.sqrt((8*m*a**2*E_n)/h**2)
print("Quantum number if the object is moving with a minimum speed of 1m/s is {0:.4g}".format(n))
delta_E = (h**2/(8*m*a**2))*(2*n+1) # delta_E=E_n+1-En
print("Separation of energy levels of the object moving with speed of 1 m/s in Joules is {0:.4g}".format(delta_E))
```

In [6]:

```
# Given
h_bar = 1.054*10**-34 # in J s
delta_x = 0.1*10**-9 # in m
m_e = 9.1*10**-31 # in Kg
# Calculations and Results
delta_Px = h_bar/delta_x
print("uncertainty in momentum in Kg m/s is {0:.4g}".format(delta_Px))
delta_v = delta_Px/m_e
KE = delta_Px**2/(2*m_e)
print("Uncertainty in Kinetic Energy in J is {0:.4g}".format(KE))
```

In [7]:

```
# Given
h_bar = 1.054*10**-34 # in J s
delta_x = 1.0 # in m
m = 0.1 # in Kg
# Calculations and Results
delta_Px = h_bar/delta_x
delta_v = delta_Px/m
print("minimum uncertainty in the velocity in m/s is {0:.4g}".format(delta_v))
```

In [8]:

```
import math
# Given
h_bar = 1.054*10**-34 # in J s
m = 9.1*10**-31 # in Kg
e = 1.6*10**-19 # in coulombs
Vo = 10.0 # in ev
Vo *= e # in J
E = 7.0 # in eV
E *= e # in J
a = 5*10**-9 # in m
# Calculations and Results
alpha = math.sqrt(2*m*(Vo-E)/h_bar**2)
To = 16*E*(Vo-E)/Vo**2
T = To*math.exp(-2*alpha*a)
print("Transmission coefficient of conduction electrons in copper is {0:.4g}".format(T))
a = 1*10**-9 # in m
T = To*math.exp(-2*alpha*a)
print("Transmission coefficient if the oxide barrier is 1 nm is {0:.4g}".format(T))
# slight change in the answer due to approximations in alpha value
```

In [11]:

```
import math
# Given
h_bar = 1.054*10**-34 # in J s
m = 100.0 # in Kg
g = 10.0 # in m/s2
h = 10.0 # in m
h1 = 15.0 # in m
a = 10.0 # in m
E = m*g*h # total energy of carriage
Vo = m*g*h1 # PE required to reach the peak
# Calculations and Results
alpha = math.sqrt(2*m*(Vo-E)/h_bar**2)
To = 16*E*(Vo-E)/Vo**2
T = To*math.exp(-2*alpha*a)
print("Transmission probability is {0:.4g}".format(T))
h_bar = 10*10**3 # Js
alpha = math.sqrt(2*m*(Vo-E)/h_bar**2)
D = Vo**2/(4*E*(Vo-E))
T = (1+(math.sinh(alpha*a))**2)**-1
print("transmission probability in a universe where h_bar is 10KJs is {0:.4g}".format(T))
```

In [13]:

```
# Given
x = 9
# Calculation and Results
for n1 in range(1, x+1):
for n2 in range(1, x+1):
for n3 in range(1, x+1):
y = n1**2+n2**2+n3**2 # let y=N**2=n1**2+n2**2+n3**2
if y == 41:
print('{0}\t{1}\t{2}'.format(n1, n2, n3))
print("Thus there are nine possible states")
```

In [14]:

```
import math
# Given
h = 6.6*10**-34 # in J s
c = 3*10**8 # in m/s
m = 9.1*10**-31 # in Kg
e = 1.6*10**-19 # in coulombs
v = 2.1*10**6 # in m/s
E = m*v**2/2.0 # in J
E /= e # in eV
E1 = -13.6 # in eV
# Calculations and Results
# change in the energy is E=En-E1
n = math.sqrt(-13.6/(E+E1))
print(" the electron gets excited to {0:.4f} level".format(n))
n = 3.0
E3 = -13.6/n**2
delta_E31 = E3-E1 # in eV
delta_E31 *= e # in J
lambda_31 = h*c/delta_E31
print("wavelength of emitted radiation from n=3 to n=1 in nm is {0:.4f}".format(lambda_31*10**9))
# Another probability is transition fromm n=3 to n=2
n = 2.0
E2 = -13.6/n**2
delta_E32 = E3-E2 # in eV
delta_E32 *= e # in J
lambda_32 = h*c/delta_E32
print("wavelength of emitted radiation from n=3 to n=2 in nm is {0:.4f}".format(lambda_32*10**9))
# Another probability is transition fromm n=2 to n=1
E2 = -13.6/n**2
delta_E21 = E2-E1 # in eV
delta_E21 *= e # in J
lambda_21 = h*c/delta_E21
print("wavelength of emitted radiation from n=2 to n=1 in nm is {0:.4f}".format(lambda_21*10**9))
```

In [15]:

```
# Given
Z = 2.0
n = 1.0
# Calculations and Results
E1 = -Z**2*13.6/n**2
E1 = abs(E1)
print("Energy required to ionize He+ further in eV is {0:.4f}".format(E1))
```

In [16]:

```
# Given
Z = 1.0
n1 = 2.0
n2 = 3.0
R_inf = 1.0974*10**7 # in m**-1
# Calculations and Results
# Let x=1/lambda
x = R_inf*Z**2*((1/n1**2)-(1/n2**2))
lambda_val = 1.0/x
print("Wavelength of first spectral line in Angstroms is {0:.4f}".format(lambda_val*10**10))
n1 = 2.0
n2 = 4.0
x = R_inf*Z**2*((1/n1**2)-(1/n2**2))
lambda_val = 1.0/x
print("Wavelength of second spectral line in Angstroms is {0:.4f}".format(lambda_val*10**10))
print("These spectral lines correspond to H_alpha and H_beta lines of Hydrogen")
```

In [17]:

```
# Given
h = 6.6*10**-34 # in J s
e = 1.6*10**-19 # in coulombs
E1 = 13.6 # in eV
E1 *= e # in J
Z = 1.0
n1 = 109.0
n2 = 110.0
ao = 52.918*10**-12 # in m
# Calculations and Results
v = Z**2*E1*((1.0/n1**2)-(1.0/n2**2))/h
print("Frequency of radiation in MHz is {0:.4f}".format(v*10**-6))
print("The frequency of radiation in the transition from n1=109 to n2=110 is same as that "
"of the detected frequency .Hence, the radiation comes from excited hydrogen atoms in"
" the give transition")
x = 2*n2**2*ao
print("The size of the atom in micro meter is {0:.4f}".format(x*10**6))
# slight difference in the answer is due to approximations
```

In [18]:

```
# Given
P_out = 2.5*10**-3 # in Watt
I = 5*10**-3 # in Amp
V = 2000.0 # in volts
# Calculations and Results
P_in = V*I
E = (P_out/P_in)*100
print("Efficiency of the laser in % is {0:.4f}".format(E))
```

In [19]:

```
import math
# Given
lambda_o = 632.8*10**-9 # in m
c = 3*10**8 # in m/s
T = 127.0 # in degree celsius
T += 273.0 # in Kelvin
m_A = 20.2*10**-3 # in Kg/mol
NA = 6.023*10**23 # mol**-1
k = 1.38*10**-23 # in J/K
# Calculations and Results
m = m_A/NA # in Kg
vx = math.sqrt(k*T/m)
vo = c/lambda_o
delta_v = 2*vo*vx/c
print("delta_v in GHz is {0:.4g}".format(delta_v))
delta_lambda = delta_v*(-lambda_o/vo)
print("delta_lambda in meters is {0:.4g}".format(abs(delta_lambda)))
```