#initialisation of variables
p= 14.7 #lbf/in**2
p1= 5. #lbf/in**2
w= 62.3 #lbf/ft**3
h= 30. #ft
#CALCULATIONS
hmax= (p-p1)*144/w
hmin= h-hmax
#RESULTS
print ' Minimum depth of the water= %.1f ft'%(hmin)
#initialisation of variables
import math
T= 20. #C
h= 1. #cm
dw= 1. #gf/cm**3
dm= 13.6 #gf/cm**3
g= 981. #dyne
Tw= 74. #dyne/cm
Tm= 465. #dyne/cm
#CALCULATIONS
hw= (4*Tw)/(dw*g*(h/10))
hm= (4*Tm*math.cos(math.radians(130)))/(dm*g*(h/10))
#RESULTS
print 'capillary rise of water= %.1f cm'%(hw)
print 'capillary rise of mercury= %.2f cm'%(hm)
print 'In a tube 1 cm bore, which is about the size used in gauges in mant engineering \n \
recorders, the figures would be %.0f mm and %.2f mm'%(hw,hm)
# answers may vary because of rounding error and inbuilt function.
#initialisation of variables
w1= 0.81
w2= 0.80
r= 40.
#CALCULATIONS
l1 = 2*w1/(w1-w2)
a1= (2*w1)/(w1-w2+(1/r)*(w1+w2))
#RESULTS
print 'limiting ratio= %.1f '%(l1)
print 'Actual ratio = %.1f'%a1
#initialisation of variables
dh= 1. #in
a= 1/40. # area
A = 1 # in.
s= 0.9 # gravity
w= 62.3 #lb/ft**3
#A = 1728
#CALCULATIONS
sensitivity = (A/(w*((A+a)-s*(A-a))))*1728
dpbyw= dh*((1+a)-s*(1-a))
dp= w*dpbyw/1728.
#RESULTS
print "Sensitivity = %.2f in/lbf"%sensitivity
print 'pressure difference = %.2e lbf/in**2 '%(dp)
#Answer in the textbook is wrong
#initialisation of variables
x= 1. #in
y= 10. #in
r= 40.
#CALCULATIONS
dbyh= 1/((x/y)+(1/r))
#RESULTS
print 'magnification factor= %.f '%(dbyh)
%matplotlib inline
from matplotlib.pyplot import *
#initialisation of variables
p= 0.005 #lbf/in**2
w= 62.4 #lbf/ft**3
h= 1. #in
pressure = [0,9.04,19.08,27.16,36.16,45.20,54.24]
scale = [1.2,3.1,5.1,6.3,8.6,10.9,13.1]
#CALCULATIONS
p= w*h/1728.
plot(scale,pressure)
plot(scale,pressure,'go-')
xlabel("Scale reading")
ylabel("Additional pressure")
suptitle("Calibration of micromanometer")
axis([0,20,0,60])
#RESULTS
print ' pressure difference = %.4f lbf/in**2 '%(p)