Quantum Mechanics and Quantum Computing

Example number 1.1, Page number 41

In [17]:
#Variable declaration
c=3*10**8             #velocity of light in m/s
h=6.626*10**-34       #planks constant 
m=1.67*10**-27        #mass of proton

#Calculation
v=c/10                #velocity of proton
lamda=h/(m*v)          #de Broglie wave length

#Result
print("the de Broglie wavelength in m is ",lamda);
('the de Broglie wavelength in m is ', 1.3225548902195607e-14)

Example number 1.2, Page number 42

In [19]:
  
#importing modules
import math

#Variable declaration
V=400;   #potential in Volts

#Calculation
lamda=12.56/math.sqrt(V);   #de Broglie wavelength

#Result
print("The de Broglie wavelength in Armstrong is",lamda);

#answer given in the book is wrong
('The de Broglie wavelength in Armstrong is', 0.628)

Example number 1.3, Page number 42

In [20]:
 
#importing modules
import math

#Variable declaration
m=1.674*10**(-27);    #mass of neutron in kg
h=6.626*10**(-34);
E=0.025;   #kinetic energy in eV

#Calculation
Ej=E*1.6*10**-19;   #kinetic energy in J
lamda=h/math.sqrt(2*m*Ej);   #de Broglie wavelength
lamdaA=lamda*10**10;   #converting wavelength from m to Armstrong
lamdaA=math.ceil(lamdaA*10**3)/10**3;   #rounding off to 3 decimals

#Result
print("The de Broglie wavelength in metres is",lamda);
print("The de Broglie wavelength in Armstrong is",lamdaA);
('The de Broglie wavelength in metres is', 1.81062582829353e-10)
('The de Broglie wavelength in Armstrong is', 1.811)

Example number 1.4, Page number 42

In [21]:
 
#importing modules
import math

#Variable declaration
V=1600;   #potential in Volts

#Calculation
lamda=12.56/math.sqrt(V);   #de Broglie wavelength
lamda=math.ceil(lamda*10**2)/10**2;   #rounding off to 2 decimals

#Result
print("The de Broglie wavelength in Armstrong is",lamda);
('The de Broglie wavelength in Armstrong is', 0.32)

Example number 1.5, Page number 42

In [22]:
 
#importing modules
import math

#Variable declaration
deltax=0.2;   #distance in armstrong
h=6.626*10**(-34);

#Calculation
delta_xm=deltax*10**-10;    #distance in m
delta_p=h/(2*math.pi*delta_xm);

#Result
print("The uncertainity in momentum of electron in kg m/sec is",delta_p);
('The uncertainity in momentum of electron in kg m/sec is', 5.2728032646344916e-24)

Example number 1.6, Page number 43

In [23]:
 
#importing modules
import math

#Variable declaration
n1=1;
n2=1;
n3=1;    #values in lowest energy
h=6.62*10**(-34);
M=9.1*10**-31;   #mass in kg
L=0.1;   #side in nm

#Calculation
L=L*10**-9;    #side in m
n=(n1**2)+(n2**2)+(n3**2);
E1=(n*h**2)/(8*M*L**2);    #energy in j
E1eV=E1/(1.6*10**-19);    #energy in eV
E1eV=math.ceil(E1eV*10)/10;   #rounding off to 1 decimals

#Result
print("lowest energy of electron in Joule is",E1);
print("lowest energy of electron is eV",E1eV);

#answer for lowest energy in eV given in the book is wrong
('lowest energy of electron in Joule is', 1.8059505494505486e-17)
('lowest energy of electron is eV', 112.9)

Example number 1.7, Page number 43

In [24]:
 
#importing modules
import math

#Variable declaration
M=9.1*10**(-31);    #mass of electron in kg
h=6.66*10**(-34);
E=2000;   #kinetic energy in eV

#Calculation
Ej=E*1.6*10**-19;   #kinetic energy in J
lamda=h/math.sqrt(2*M*Ej);   #de Broglie wavelength
lamdaA=lamda*10**9;   #converting wavelength from m to nm
lamdaA=math.ceil(lamdaA*10**3)/10**3;   #rounding off to 3 decimals

#Result
print("The de Broglie wavelength in nm is",lamdaA);
('The de Broglie wavelength in nm is', 0.028)

Example number 1.8, Page number 43

In [23]:
 
#importing modules
import math

#Variable declaration
n=1;   #for minimum energy
h=6.626*10**(-34);
m=9.1*10**-31;   #mass in kg
L=4*10**-10;   #size in m

#Calculation
E1=(n*h**2)/(8*m*L**2);    #energy in j

#Result
print("lowest energy of electron in Joule is",E1);

#answer given in the book is wrong
('lowest energy of electron in Joule is', 3.7692201236263733e-19)

Example number 1.9, Page number 44

In [26]:
 
#importing modules
import math
from __future__ import division

#Variable declaration
h=6.626*10**(-34);
m=9.1*10**-31;   #mass in kg
lamda=1.66*10**-10;   #wavelength in m

#Calculation
v=h/(m*lamda);    #velocity in m/sec
v_km=v*10**-3;    #velocity in km/sec
E=(1/2)*m*v**2;    #kinetic energy in joule
EeV=E/(1.6*10**-19);    #energy in eV
EeV=math.ceil(EeV*10**3)/10**3;   #rounding off to 3 decimals

#Result
print("velocity of electron in m/sec is",round(v));
print("velocity of electron in km/sec is",round(v_km));
print("kinetic energy of electron in Joule is",E);
print("kinetic energy of electron in eV is",EeV);
('velocity of electron in m/sec is', 4386337.0)
('velocity of electron in km/sec is', 4386.0)
('kinetic energy of electron in Joule is', 8.754176510091736e-18)
('kinetic energy of electron in eV is', 54.714)

Example number 1.10, Page number 44

In [27]:
 
#importing modules
import math

#Variable decleration
V=15;   #potential in kV

#Calculation
v=V*10**3;    #potential in V
lamda=12.26/math.sqrt(v);    #de Broglie wavelength
lamda=math.ceil(lamda*10**2)/10**2      #rounding off to 2 decimals

#result
print("The de Broglie wavelength in Armstrong is",lamda);
('The de Broglie wavelength in Armstrong is', 0.11)

Example number 1.11, Page number 44

In [28]:
 
#importing modules
import math

#Calculation
m=1.675*10**-27;    #mass of neutron in kg
h=6.626*10**-34;
E=10;   #kinetic energy in keV

#Calculation
EeV=E*10**3;    #Energy in eV
Ej=EeV*1.6*10**-19;   #kinetic energy in J
v=math.sqrt(2*Ej/m);  #velocity in m/s
lamda=h/(m*v);    #de broglie wavelength in m
lamda_A=lamda*10**10;   #de broglie wavelength in armstrong
lamda_A=math.ceil(lamda_A*10**4)/10**4      #rounding off to 4 decimals

#Result
print("The velocity in m/sec is",round(v));
print("The de Broglie wavelength in metres is",lamda);
print("The de Broglie wavelength in Armstrong is",lamda_A);
('The velocity in m/sec is', 1382189.0)
('The de Broglie wavelength in metres is', 2.861996093951046e-13)
('The de Broglie wavelength in Armstrong is', 0.0029)

Example number 1.12, Page number 45

In [29]:
 
#importing modules
import math

#Variable decleration
m=9.1*10**-31;    #mass of electron in kg
h=6.6*10**-34;
E=2;   #kinetic energy in keV

#Calculation
EeV=E*10**3;    #Energy in eV
Ej=EeV*1.6*10**-19;   #kinetic energy in J
p=math.sqrt(2*m*Ej);   #momentum
lamda=h/p;    #de broglie wavelength in m
lamda_A=lamda*10**10;   #de broglie wavelength in armstrong
lamda_A=math.ceil(lamda_A*10**4)/10**4      #rounding off to 4 decimals

#Result
print("The de Broglie wavelength in metres is",lamda);
print("The de Broglie wavelength in Armstrong is",lamda_A);
('The de Broglie wavelength in metres is', 2.7348483695436575e-11)
('The de Broglie wavelength in Armstrong is', 0.2735)

Example number 1.13, Page number 45

In [30]:
 
#import module
import math

#Variable decleration
m=1.676*10**-27;    #mass of neutron in kg
h=6.62*10**-34;
E=0.025;   #kinetic energy in eV

#Calculation
Ej=E*1.6*10**-19;   #kinetic energy in J
v=math.sqrt(2*Ej/m);   #velocity in m/s
lamda=h/(m*v);    #wavelength in m
lamda_A=lamda*10**10;   #de broglie wavelength in armstrong
lamda_A=math.ceil(lamda_A*10**5)/10**5      #rounding off to 5 decimals

#Result
print("The neutrons wavelength in metres is",lamda);
print("The wavelength in Armstrong is",lamda_A);
('The neutrons wavelength in metres is', 1.8079065940980725e-10)
('The wavelength in Armstrong is', 1.80791)

Example number 1.14, Page number 45

In [31]:
 
#import module
import math

#Variable decleration
V=10;   #potential in kV

#Calculation
V=V*10**3;   #potential in V
lamda=12.26/math.sqrt(V);    #wavelength

#Result
print("The wavelength in Armstrong is",lamda);
('The wavelength in Armstrong is', 0.1226)

Example number 1.15, Page number 45

In [32]:
 
#import module
import math

#Varialble decleration
h=6.626*10**-34;
m=9.1*10**-31;   #mass in kg
l=1;    #width in armstrong

#Calculation
L=l*10**-10;   #width in m
#permitted electron energies En=(n**2*h**2)/(8*m*L**2)
#let X = h**2/(8*m*L**2)
X = h**2/(8*m*L**2);    #energy in J
XeV=X/(1.6*10**-19);   #energy in eV
#in the 1st level n1=1
n1=1;
E1=(n1**2)*XeV;    #energy in eV

#in second level n2=2
n2=2;
E2=(n2**2)*XeV;    #energy in eV
#in third level n3=
n3=3;
E3=(n3**2)*XeV;    #energy in eV

#Result
print("minimum energy the electron can have in eV is",round(E1));
print("other values of energy are in eV and in eV",round(E2),round(E3));

#answers given in the book are wrong
('minimum energy the electron can have in eV is', 38.0)
('other values of energy are in eV and in eV', 151.0, 339.0)

Example number 1.16, Page number 46

In [33]:
 
#import module
import math

#Variable decleration
n=1;   #lowest state
L=10;    #width in armstrong

#Calculation
L=L*10**-10;    #width in m
x=L/2;
delta_x=1;    #interval in armstrong
delta_x=delta_x*10**-10;    #interval in m
psi1=(math.sqrt(2/L))*math.sin(math.pi*x/L);
A=psi1**2;
p=A*delta_x;
p=math.ceil(p*10)/10;   #de broglie wavelength in armstrong

#Result
print("probability of finding the particle is ",p);
('probability of finding the particle is ', 0.2)

Example number 1.17, Page number 46

In [34]:
 
#import module
import math
from __future__ import division

#Variable decleration
d=970;   #density of Na in kg/m^3
n=6.02*10**26;
h=6.62*10**(-34);
m=9.1*10**-31;   #mass in kg
w=23;   #atomic weight

#Calculation
N=(d*n)/w;   #number of atoms per m^3
A=(h**2)/(8*m);
B=(3*N)/math.pi;
Ef=A*B**(2/3);
EfeV=Ef/(1.6*10**-19);
EfeV=math.ceil(EfeV*10**2)/10**2           #rounding of to 2 decimals

#Result
print("fermi energy of Na in eV is",EfeV);
('fermi energy of Na in eV is', 3.16)

Example number 1.18, Page number 46

In [35]:
 
#import module
import math
from __future__ import division

#Variable decleration
n1=1;
n2=1;
n3=1;    #values in lowest energy
h=6.62*10**(-34);
m=9.1*10**-31;  #mass in kg
L=0.1;   #side in nm

#Calculation
L=L*10**-9;    #side in m
n=(n1**2)+(n2**2)+(n3**2);
E1=(n*h**2)/(8*m*L**2);    #energy in j
E1eV=E1/(1.6*10**-19);    #energy in eV
E1eV=math.ceil(E1eV*10**1)/10**1      #rounding off to 2 decimals

#Result
print("lowest energy of electron in Joule is",E1);
print("lowest energy of electron in eV is",E1eV);
('lowest energy of electron in Joule is', 1.8059505494505486e-17)
('lowest energy of electron in eV is', 112.9)

Example number 1.19, Page number 47

In [36]:
 
#import module
import math
from __future__ import division

#Variable decleration
mn=1.676*10**-27;   #mass of neutron in kg
me=9.1*10**-31;    #mass of electron in kg
h=6.62*10**-34;
c=3*10**8;         #velocity of light in m/sec

#Calculation
En=2*me*c**2;
lamda=h/math.sqrt(2*mn*En);   #wavelength in m
lamda_A=lamda*10**10;    #converting lamda from m to A
lamda_A=math.ceil(lamda_A*10**6)/10**6      #rounding off to 6 decimals

#Result
print("The de broglie wavelength in Angstrom is",lamda_A);
('The de broglie wavelength in Angstrom is', 0.000283)

Example number 1.20, Page number 47 *

In [13]:
#import module
import math
from __future__ import division

#Variable decleration
n2=2;    #second quantum state
n4=4;    #fourth quantum state
h=6.626*10**-34;
m=9.1*10**-31;   #mass in kg
a=2;   #potential box length in armstrong

#Calculation
a=a*10**-10;    #length in m
A=n2**2*h**2;
B=8*m*a**2;
E2=A/B;    #energy in j
E2eV=E2/(1.6*10**-19);    #energy in eV
C=n4**2*h**2;
E4=C/B;    #energy in j
E4eV=E4/(1.6*10**-19);    #energy in eV

#Result
print("energy corresponding to second quantum state in Joule is",E2);
print("energy corresponding to second quantum state in eV is",E2eV);
print("energy corresponding to fourth quantum state in Joule is",E4);
print("energy corresponding to fourth quantum state in eV is",E4eV);


#answers given in the book are wrong
('energy corresponding to second quantum state in Joule is', 6.030752197802197e-18)
('energy corresponding to second quantum state in eV is', 37.69220123626373)
('energy corresponding to fourth quantum state in Joule is', 2.412300879120879e-17)
('energy corresponding to fourth quantum state in eV is', 150.7688049450549)

Example number 1.21, Page number 48 *

In [38]:
 
#import module
import math
from __future__ import division

#Variable decleration
V=344;   #accelerated voltage in V
n=1;    #first reflection
theta=60;   #glancing angle in degrees

#Calculation
lamda=12.27/math.sqrt(V);
d=(n*lamda)/(2*math.sin(theta));

#Result
print("The spacing of the crystal in Angstrom is",lamda);
('The spacing of the crystal in Angstrom is', 0.6615540636030947)

Example number 1.22, Page number 49 *

In [39]:
 
#import module
import math
from __future__ import division

#Variable decleration
n2=2;    #second quantum state
n3=3;    #fourth quantum state
h=6.626*10**-34;
m=9.1*10**-31;   #mass in kg
a=1*10**-10;    #width of potential well in m

#Calculation
B=8*m*a**2;
E1=h**2/B;   #ground state energy
E1eV=E1/(1.6*10**-19);    #energy in eV
A=n2**2*h**2;
E2=A/B;    #energy in j
E2eV=E2/(1.6*10**-19);    #energy in eV
C=n3**2*h**2;
E3=C/B;    #energy in j
E3eV=E3/(1.6*10**-19);    #energy in eV
E1=math.ceil(E1*10**3)/10**3      #rounding off to 3 decimals
E1eV=math.ceil(E1eV*10**3)/10**3      #rounding off to 3 decimals
E2eV=math.ceil(E2eV*10**3)/10**3      #rounding off to 3 decimals
E3eV=math.ceil(E3eV*10**3)/10**3      #rounding off to 3 decimals

#Result
print("ground state energy in Joule is",E1);
print("ground state energy in eV is",E1eV);
print("first energy state in eV is",E2eV);
print("second energy state in eV is",E3eV);

#answers given in the book are wrong by one decimal
('ground state energy in Joule is', 0.001)
('ground state energy in eV is', 37.693)
('first energy state in eV is', 150.769)
('second energy state in eV is', 339.23)

Example number 1.23, Page number 49

In [4]:
 
#import module
import math

#Variable decleration
n3=3;    #fourth quantum state
h=6.626*10**-34;
m=9.1*10**-31;   #mass in kg


#ground state energy E1 = h**2/(8*m*a**2)
#second excited state E3 = (9*h**2)/(8*m*a**2)
#required energy E = E3-E1
#E = (9*h**2)/(8*m*a**2) - h**2/(8*m*a**2)
#E = (h**2/(8*m*a**2))*(9-1)
#therefore E = (8*h**2)/(8*m*a**2)
#hence E = (h**2)/(m*a**2)

#Result 
# the required energy is E = (h**2)/(m*a**2)

Example number 1.24, Page number 50

In [40]:
 
#import module
import math
from __future__ import division

#Variable decleration
delta_x=10**-8;   #length of box in m
h=6.626*10**-34;
m=9.1*10**-31;   #mass in kg

#Calculation
delta_v=h/(m*delta_x);    #uncertainity in m/sec
delta_vk=delta_v*10**-3;   #uncertainity in km/sec
delta_vk=math.ceil(delta_vk*10**2)/10**2      #rounding off to 2 decimals

#Result
print("minimum uncertainity in velocity in m/sec is",round(delta_v));
print("minimum uncertainity in velocity in km/sec is",delta_vk);
('minimum uncertainity in velocity in m/sec is', 72813.0)
('minimum uncertainity in velocity in km/sec is', 72.82)

Example number 1.25, Page number 50

In [41]:
  
#import module
import math
from __future__ import division

#Variable decleration
mp=1.6*10**-27;   #mass of proton in kg
me=9.1*10**-31;    #mass of electron in kg
h=6.626*10**(-34);
c=3*10**10;    #velocity of light in m/sec

#Calculation
Ep=me*c**2;
lamda=h/math.sqrt(2*mp*Ep);   #wavelength in m
lamda_A=lamda*10**10;    #converting lamda from m to A

#Result
print("The de broglie wavelength in Angstrom is",lamda_A);
('The de broglie wavelength in Angstrom is', 4.092931643497047e-06)

Example number 1.26, Page number 51 *

In [16]:
 
#import module
import math
from __future__ import division

#Variable decleration
m=1.675*10**(-27);    #mass of neutron in kg
h=6.626*10**(-34);
n=1;   #diffractive order
d=0.314;   #spacing in nm
E=0.04;   #kinetic energy in eV

#Calculation
d=d*10**-9;   #spacing in m
Ej=E*1.6*10**-19;   #kinetic energy in J
lamda=h/math.sqrt(2*m*Ej);   #de Broglie wavelength
lamdaA=lamda*10**9;   #converting wavelength from m to nm
theta=math.asin((n*lamda)/(2*d));
print("The de Broglie wavelength in metres is",lamda);
print("The de Broglie wavelength in nm is",lamdaA);
print("glancing angle in degrees is",theta);

#answer given in the book is wrong
('The de Broglie wavelength in metres is', 1.4309980469755228e-10)
('The de Broglie wavelength in nm is', 0.1430998046975523)
('glancing angle in degrees is', 0.2298853909391574)
In [ ]: