In [1]:

```
#To calculate the energy and momentum of photon
#importing modules
import math
#Variable declaration
c = 3*10**8; #velocity of light(m/sec)
h = 6.62*10**-34; #planck's constant
lamda = 1.2; #wavelength of photon(Angstrom)
e = 1.6*10**-19; #conversion factor from J to eV
#Calculation
lamda = lamda*10**-10; #wavelength of photon(m)
E = (h*c)/(lamda*e); #energy of photon(eV)
E=math.ceil(E*10)/10; #rounding off to 1 decimal
p = h/lamda; #momentum of photon(kg m/s)
#Result
print "energy of the photon is",E,"eV"
print "momentum of the photon is",p,"kg m/s"
```

In [2]:

```
#To calculate the number of photons emitted
#importing modules
import math
#Variable declaration
h = 6.625*10**-34; #planck's constant
new = 900; #frequency(kHz)
E1 = 10; #power radiated(kW)
#Calculation
E1 = E1*10**3; #power radiated(W)
new = new*10**3; #frequency(Hz)
E = h*new; #energy of photon(J)
N = E1/E; #number of photons emitted
#Result
print "number of photons emitted per second is",N
```

In [4]:

```
#To calculate the number of photons emitted
#importing modules
import math
#Variable declaration
c = 3*10**8; #velocity of light(m/sec)
h = 6.63*10**-34; #planck's constant
lamda = 5893; #wavelength of photon(Angstrom)
E1 = 100; #power of lamp(W)
#Calculation
lamda = lamda*10**-10; #wavelength of photon(m)
E = h*c/lamda; #energy of photon(J)
N = E1/E; #number of photons emitted
#Result
print "number of photons emitted per second is",N
print "answer given in the book is wrong"
```

In [5]:

```
#To calculate the wavelength of scattered radiation
#importing modules
import math
#Variable declaration
c = 3*10**8; #velocity of light(m/sec)
h = 6.6*10**-34; #planck's constant
m0 = 9.1*10**-31; #mass of photon(kg)
theta = 30; #viewing angle(degrees)
lamda = 2.8*10**-10; #wavelength of photon(m)
#Calculation
x = math.pi/180; #conversion factor from degrees to radians
theta = theta*x; #viewing angle(radian)
lamda_dash = (2*h*(math.sin(theta/2))**2/(m0*c))+lamda; #wavelength of scattered radiation(m)
lamda_dash = lamda_dash*10**10; #wavelength of scattered radiation(Angstrom)
lamda_dash=math.ceil(lamda_dash*10**5)/10**5; #rounding off to 5 decimals
#Result
print "wavelength of scattered radiation is",lamda_dash,"Angstrom"
```

In [6]:

```
#To calculate the deBroglie wavelength
#importing modules
import math
#Variable declaration
h = 6.6*10**-34; #planck's constant
m = 0.040; #mass of bullet(kg)
v = 1; #speed of bullet(km/s)
#Calculation
v = v*10**3; #speed of bullet(m/s)
p = m*v; #momemtun of bullet(kg m/s)
lamda = h/p; #deBroglie wavelength(m)
lamda = lamda*10**10; #deBroglie wavelength(Angstrom)
#Result
print "deBroglie wavelength is",lamda,"Angstrom"
```

In [8]:

```
#To calculate the energy of particle
#importing modules
import math
#Variable declaration
n = 1; #lowest energy state
a = 0.1; #width of box(nm)
h = 6.625*10**-34; #planck's constant
e = 1.602*10**-19; #conversion factor from J to eV
m = 9.11*10**-31; #mass of particle(kg)
#Calculation
a = a*10**-9; #width of box(m)
E = (n**2)*(h**2)/(8*m*(a**2)); #energy of particle(J)
E_eV = E/e; #energy of particle(eV)
E_eV=math.ceil(E_eV*10)/10; #rounding off to 1 decimal
#Result
print "energy of particle is",E,"J or",E_eV,"eV"
```

In [9]:

```
#To calculate the minimum energy of an electron
#importing modules
import math
#Variable declaration
n = 1; #lowest energy state
a = 4; #width of well(nm)
h = 6.625*10**-34; #planck's constant
e = 1.6025*10**-19; #conversion factor from J to eV
m = 9.11*10**-31; #mass of electron(kg)
#Calculation
a = a*10**-9; #width of box(m)
E = (n**2)*(h**2)/(8*m*(a**2)); #energy of particle(J)
E_eV = E/e; #energy of particle(eV)
E_eV=math.ceil(E_eV*10**4)/10**4; #rounding off to 4 decimals
#Result
print "minimum energy of electron is",E,"J or",E_eV,"eV"
```

In [11]:

```
#To calculate the energy required to excite the electron
#importing modules
import math
#Variable declaration
n1 = 1; #lowest energy state
n2 = 6; #for 6th excited state
a = 0.1; #width of box(nm)
h = 6.625*10**-34; #planck's constant
e = 1.602*10**-19; #conversion factor from J to eV
m = 9.11*10**-31; #mass of electron(kg)
#Calculation
a = a*10**-9; #width of box(m)
E1 = (n1**2)*(h**2)/(8*m*(a**2)); #energy of electron in ground state(J)
E6 = (n2**2)*(h**2)/(8*m*(a**2)); #energy of electron in excited state(J)
E = E6-E1; #energy required to excite the electron(J)
E_eV = E/e; #energy required to excite the electron(eV)
E_eV=math.ceil(E_eV*10)/10; #rounding off to 1 decimal
#Result
print "energy required to excite the electron is",E,"J or",E_eV,"eV"
print "answer for energy in eV given in the book is wrong"
```

In [12]:

```
#To calculate the change in wavelength
#importing modules
import math
#Variable declaration
h = 6.625*10**-34; #planck's constant
c = 3*10**8; #velocity of light(m/sec)
m0 = 9.11*10**-31; #rest mass of electron(kg)
phi = 90; #angle of scattering(degrees)
x = math.pi/180; #conversion factor from degrees to radians
#Calculation
phi = phi*x; ##angle of scattering(radian)
delta_lamda = h*(1-math.cos(phi))/(m0*c); #change in wavelength(m)
#Result
print "change in wavelength of X-ray photon is",delta_lamda,"m"
```

In [ ]:

```
```