Chapter 1 - matter and its atomic nature

Example 1 - pg 3

In [1]:
#calculate the Angle required
#Initialization of variables
import math
l=0.71 *10**-8 #cm
n=200. #lines/cm
v=0.00145 #radian
#calculations
d=1/n
phi2=2*l/d +v**2
phi=math.sqrt(phi2)
#results
print '%s %.2e %s' %('Angle required =',phi,'radian')
Angle required = 2.22e-03 radian

Example 2 - pg 6

In [2]:
#calculate the Interplanar distance
#Initialization of variables
import math
angle=37.25 #degrees
l=1.539 #A
n=1. #order
#calculations
d=n*l/(2*math.sin(angle/180.*math.pi))
#results
print '%s %.3f %s' %("Interplanar distance =",d,"A")
Interplanar distance = 1.271 A

Example 5 - pg 18

In [3]:
#calculate the ratio of radii
#Initialization of variables
import math
r1=math.sqrt(3.)
r2=1
#calculations
ratio=r1-r2
#results
print '%s %.3f' %('Ratio of radii =',ratio)
Ratio of radii = 0.732

Example 6 - pg 21

In [4]:
#calculate the Avagadro number
#Initialization of variables
d=2.64 #g/cc
l=4.016*10**-8 #cm
n=4
M=25.94 #g/mol
#calculations
m=d*l**3 /n
N0=M/m
#results
print '%s %.3e %s' %("Avagadro number =",N0," molecule/mol")
Avagadro number = 6.068e+23  molecule/mol

Example 10 - pg 28

In [5]:
#calculate the angle required
#Initialization of variables
import math
import numpy
A=numpy.array([-1, -1, -1 ])
B=numpy.array([1, 1, -1])
#calculations
Ad=math.sqrt(1+1+1)
Bd=math.sqrt(1+1+1)
dot=numpy.dot(A,B) /(Ad*Bd) 
theta=math.acos(dot) *180./math.pi
#results
print '%s %.2f %s' %("Angle =",theta," degrees")
Angle = 109.47  degrees