Chapter 1 - Physics and Engineering

Example 1 - pg 11

In [2]:
#calculate the percentage error
#Given:
l=9.3; # length in cm
b=8.5;# breadth in cm
h=5.4;# height in cm
#calculations
V= l*b*h; # Volume in cm**3
delta_l = 0.1; delta_b = 0.1; delta_h = 0.1; # scale has a least count = 0.1 cm
# absolute error 
delta_V = (b*h*delta_l + l*h*delta_b +l*b*delta_h); # in cm**3
#relative error 
re = delta_V/V;
p= re*100; # Evaluating percentage error
#results
print "Percentage Error (percentage) = ",round(p,0)
Percentage Error (percentage) =  4.0

Example 2 - pg 12

In [3]:
#calculate the percentage error
#Given :
M= 10.0; #weight in g
V= 5.80;#volume in cm**3
#calculations
Rho = M/V; # Density in g/cm**3
delta_M= 0.2 #  apparatus has a least count of 0.2 g
delta_V= 0.05# apparatus has a least count of 0.05 cm**3
delta_Rho = (delta_M/V) +((M*delta_V)/V**2);# absolute error in g/cm**3
re = delta_Rho/Rho ; #Evaluating Relative Error
p = re*100;# Evaluating Percentage Error
#results
print "Percentage error (percentage) = ",round(p,2)
print'Result obtained differs from that in textbook, because delta_M walue is taken 0.1 g , instead of 0.2 g as mentioned in the problem statement.'
Percentage error (percentage) =  2.86
Result obtained differs from that in textbook, because delta_M walue is taken 0.1 g , instead of 0.2 g as mentioned in the problem statement.

Example 3 - pg 16

In [5]:
#calculate the Actual val of c/r ranges and percentage error
#Given:
#(a) 
import math
lc = 0.1# least count in cm
c = 6.9 #Circumference c in cm
r= 1.1 # radius of circle in cm
val =2*math.pi;
# Circumference,c= 2*pi*r or  c/r = 2*pi
# Error in c/r is , delta(c/r)= [(c/r**2)+(1/r)](LC/2) , LC is Least Count .
E= ((c/r**2)+(1./r))*(lc/2.);#Error in c/r is delta(c/r)
ob = c/r; # Observed Value
#Actual Value of c/r ranges between
ac1 = ob-E;# Evaluating Minimum value for c/r 
ac2 = ob+E;# Evaluating Maximum value for c/r
p = (E/ob)*100.; #Evaluating percentage error
#results
print "(a)Actual Value of c/r ranges between",round(ac1,1), "-",round(ac2,1)," and Percentage error =",round(p,1)," percentage. "
#(b)
lc1 = 0.001;#Now the least count is 0.001 cm
c1 = 6.316;#Circumference in cm
r1=1.005;#Circle radius in cm 
E1 =((c1/r1**2) + (1/r1))*(lc1/2); # Error in c/r is delta(c/r)
ob1= c1/r1; #Observed Value
p1=(E1/ob1)*100.;#Evaluating percentage error
#Actual Value of c/r ranges between
a1= ob1-E1;#Evaluating Minimum value for c/r
a2= ob1+E1;#Evaluating Maximum value for c/r
print "(b)Actual Value of c/r ranges between",round(a1,3),"-",round(a2,3),"and Percentage error =",round(p1,2)," percentage."
(a)Actual Value of c/r ranges between 5.9 - 6.6  and Percentage error = 5.3  percentage. 
(b)Actual Value of c/r ranges between 6.281 - 6.288 and Percentage error = 0.06  percentage.

Example 4 - pg 17

In [6]:
#calculate the percentage lower or higher than experimental value
#Given
import math
# (a) Newton's Theory
# v= (P/rho)**2  , P= Pressure , rho = density
P = 76.; # 76 cm of Hg pressure
V= 330. ; # velocity of sound in m/s
rho = 0.001293; # density for dry air at 0 degrees celsius in g/cm**3
g = 980.;#gravitational acceleration in cm/s**2
#Density of mercury at room temperature is 13.6 g/cm**3 
# 1 cm**2 = 1.0*10**-4 m**2
#calculations
v = math.sqrt(((P*13.6*g)/rho)*10**-4); # velocity of sound in m/s
p= ((V-v)/V)*100; # % lower than the experimental value
#results
print "(a) It is is",round(p,0)," percentage lower than the experimental value."

# (b) Laplace's Theory 
# v= ((gama*P)/rho)**2., gamma = adiabatic index Thus,
#Given :
gama = 1.41 # Adiabatic index
#Density of mercury at room temperature is 13.6 g/cm**3 
# 1 cm**2 = 1.0*10**-4 m**2
v1 = math.sqrt(((gama*P*13.6*g)/rho)*10**-4);# velocity of sound in m/s
p1 = ((V-round(v1))/V)*100;# % higher than the eperimental value
#results
print "(b) It is",round(abs(p1),1),"percentage  higher than the experimental value."
(a) It is is 15.0  percentage lower than the experimental value.
(b) It is 0.6 percentage  higher than the experimental value.