#initialisation of variables
h1 = 2 #in
h2 = 2 #in
wn = 13.6 #g/cc
w = 1 #g/cc
W = 62.4 #lbs/ft**3
#CALCULATIONS
ha = ((h2*wn/w)-h1)/12
pa = ha*W/144
#RESULTS
print 'Pressure of water = %.2f lb/sq in '%(pa)
#initialisation of variables
a = 6 #ft
h = 2 #ft
sm = 13.6
sw = 1
sl =0.8
#CALCULATIONS
dh = h*(sm-sw)+a
h1 = (dh-a)/(sl-1)
#RESULTS
print 'pressure difference in ft of water = %.1f ft of water '%(dh)
print 'reading of mercury = %.f ft of liquid '%(h1)
#initialisation of variables
sm = 13.6
so = 0.9
sw =1
hb = 8 #ft
hc = 7.5 #ft
hd = 1.75 #ft
#CALCULATIONS
pa = (sm-so)*sw
pc = pa - hb*so
pd = pa+so*2-sm*2.5-hc
pb = hb+hd+pd
#RESULTS
print 'pressure at A = %.2f ft of water '%(pa)
print 'pressure at B = %.2f ft of water '%(pb)
print 'pressure at C = %.2f ft of water '%(pc)
print 'pressure at D = %.2f ft of water '%(pd)
#initialisation of variables
lm = 2 #ft
lw = 5 #ft
lo = 8 #ft
so = 0.75
p = 40 #lb/in**2
w = 62.4 #lbs/ft**3
sm = 13.6
#CALCULATIONS
h = p*144/w
Pd = (h-lm*sm)
Pc = Pd-lw
Pb = Pc-lo*so
Pg = Pb*w/144
#RESULTS
print 'Reading of the pressure guage at the top of tank = %.1f lb/in**2 '%(Pg)
#initialisation of variables
h = 42 #in
w = 62.4 #lbs/ft**3
#RESULTS
D = h*w/(144*12)
#CALCULATIONS
print 'Depth of point = %.1f lb/in**2 '%(D)
#initialisation of variables
h = 200 #ft
w = 62.4 #lbs/ft**3
#RESULTS
D = h*w/(144)
#CALCULATIONS
print 'Depth of point = %.1f lb/in**2 '%(D)
#initialisation of variables
w = 62.4 #lbs/ft**3
l = 2 #ft
b = 3 #ft
h = 10 #ft
#CALCULATIONS
P = w*l*b*h
#RESULTS
print 'Total pressure = %.f lb '%(P)
import math
#initialisation of variables
l = 2. #ft
b = 3. #ft
a = 60. #degrees
h = 8. #ft
w = 62.4 #lbs/ft**3
#CALCULATIONS
x = h+(b/l)*math.cos(math.radians(a))
P = w*l*b*x
#RESULTS
print 'total pressure = %.f lb '%(P)
# Note : Answer is different in book please calculate manually using calculator.
#initialisation of variables
l = 2. #ft
b = 3. #ft
h = 8. #ft
w = 62.4 #lbs/ft**3
#CALCULATIONS
P = w*l*b*(h+(b/2))
#RESULTS
print 'total pressure = %.f lb '%(P)
# Note : Answer is different in book please calculate manually using calculator.
#initialisation of variables
l = 6. #ft
b = 4. #ft
w = 62.4 #lbs/ft**3
h = 10. #ft
#CALCULATIONS
P = w*l*b*(b/2)
hn = (b/2)+(l*b**3/(12*l*b*(b/2)))
P1 = w*(h+(b/2))*l*b
h1 = (h+(b/2))+(l*b**3/(12*l*b*(h+(b/2))))
#RESULTS
print "Total pressure = %d lb"%(P1)
print "Depth = %.2f ft"%(hn)
print 'pressure in ft in case 2 = %.3f ft '%(h1)
import math
#initialisation of variables
sp = 0.87
d = 12. #ft
W = 62.4 #lb/ft**3
Wa = 30. #lb/in**2
#CALCULATIONS
A = math.pi*d**2/4
w = W*sp
x = Wa*144/(w)
P = round(w*A*x,-3)
h = x+(A*d**2/16/(A*x))
#RESULTS
print 'force exerted by the oil upon the gate = %.f lb '%(P)
print ' position of centre of pressure = %.3f ft '%(h)
# Note : Answer may vary because of rounding error.
#initialisation of variables
import math
w = 62.4 #lb/ft**3
a = 60. #degrees
l = 18. #ft
b = 4. #ft
W = 8000. #lb
#CALCULATIONS
P = w*b/(math.sin(math.radians(a))*2)
h = ((b/(12*(math.sin(math.radians(a)))**3))*(math.sin(math.radians(a)))**2/(b/(math.sin(math.radians(a))*2)))+0.5
h1 = (1-h)/math.sin(math.radians(a))
x = ((l*W)/(h1*P))**(1./3)
#RESULTS
print 'Level of water = %.2f ft '%(x)
import math
#initialisation of variables
w = 62.4 #lb/ft**3
l = 12 #ft
b = 6 #ft
h = 5.196 #ft
a = 60 #degrees
a1 = 45 #degrees
#CALCULATIONS
P = w*l*b*h/2
h1 = ((l*b**3*(math.sin(math.radians(a)))**2/12)/(l*b*(h/2)))+(h/2)
R = round(P*(b-(h1/math.cos(math.radians(a/2))))/((b*math.sin(math.radians(a1)))/2),-2)
#RESULTS
print 'Total comression in the promp CD = %.f lb '%(R)
import math
#initialisation of variables
w = 62.4 #lb/ft**3
h = 4. #ft
b = 6. #ft
sg = 1.45
h1 = 5. #ft
a = 90. #degrees
#CALCULATIONS
P1 = w*sg*h*b*(h1+(h/2))
P2 = w*h*b*(h/2)
Pr = P1-P2
hup = ((b*h**3/12)*(math.sin(math.radians(a)))**2/(h*b*(h1+(h/2))))+(h1+(h/2))
x1 = h+h1-hup
hd = h*2/3
x2 = h-hd
x = (P1*x1-P2*x2)/Pr
d = h1+h-x
F = Pr*x/4
#RESULTS
print 'P resultant = %.f lb '%(Pr)
print 'depth of centre of pressure = %.3f ft '%(d)
print 'force F required to act horizontally at the top of gate = %.f lb '%(F)
# Note : The answer given in texxtbook is wrong. Please check using a calculator.
import math
#initialisation of variables
w = 15. #ft
D = 15. #ft
W = 62.4 #lb/ft**3
a = 120. #degrees
h1 = 15. #ft
h2 = 4. #/ft
h3 = 18. #ft
#CALCULATIONS
Pu = round(w*D*W*w/2,-3)
hu = ((w*D**3/12)/(w**2*D/2))+w/2
Pd = W*h2*w*h2/2-8
hd = ((w*h2**3/12)/(h2*h1*(h2/2)))+(h2/2)
P = Pu-Pd
h = (Pu*(h1-hu)-Pd*(h2-hd))/P
F = P/(2*math.sin(math.radians(a/4)))
RT = round(F*(h3-(h1/10)-h)/(h3-(h1/5)),-3)
RB =F-RT
#RESULTS
print 'Resultant water pressure on each gate : %d lb'%P
print 'Height of c.p from bottom %.2f ft'%h
print 'RB = %.f lb '%(RB)
#initialisation of variables
import math
h = 42. #ft
w = 25. #ft
d = 8. #ft
W = 150. #lb/ft**3
w1 = 62.4 #lb/ft**3
#CALCULATIONS
W1 = W*(h*d+(h*(w-d)/2))
P = round(w1*h*(h/2),-3)
R = round(math.sqrt(W1**2+P**2)-100,-2)
o = math.tan(math.radians(P/W1))
AE = round((d*h*(d/2)+(w-d)*h*(d+(w-d)/3)/2)/(d*h+h*(w-d)/2),2)
EF = round(14*P/W1,2)
AF = EF+AE
AH = w/2
e = round(AF-AH,1)
BS = round(W1*e*AH/(w**3/12),-1)
DS = W1/w-3
Smax = BS+DS
Smin = DS-BS
u = w1 * h
#RESULTS
print "Resultant thrust R = %d lb"%R
print 'S max = %.f lb/sq ft '%(Smax)
print ' S min = %.f lb/sq ft '%(Smin)
print 'Normal stress on vertical plane at the base due to water pressure and is uniform = %d lb/sq ft'%u
#initialisation of variables
W = 145. #lb/cu ft
M = 500. #lb
W1 = 64. #lb/cu ft
#CALCULATIONS
dW = W-W1
V = M/dW
#RESULTS
print 'Volume of concrete = %.1f cu ft '%(V)
#initialisation of variables
W = 10000. #tons
A = 15000. #ft**2
d = 15. #ft
Dsw = 64. #lb/ft**3
Dw = 62.4 #lb/ft**3
#CALCULATIONS
Vsw = 2240./Dsw
Vw = 2240./Dw
dV = Vw-Vsw
V1 = W*dV
h = W/A
h1 = d+h
#RESULTS
print 'Depth necessary to just float the ship in river = %.2f ft '%(h1)
# find Rightening moment
import math
#initialisation of variables
W = 5000. #tons
w = 10. #tons
d = 30. #ft
x = 5.5 #in
l = 10. #ft
a = 15. #degrees
#CALCULATIONS
GM = round((w*d)*l/(W*(x/12)),1)
M = round(GM*math.sin(math.radians(a))*W,-1)
#RESULTS
print 'Metacentric Height = %.1f ft'%GM
print 'Rightening moment = %.f lb '%(M)
import math
import numpy
#initialisation of variables
l = 5. #ft
h = 20. #in
n = 1./15
AG = 50. #in
x = 30. #in
w = 62.4 #lb/ft**3
#CALCULATIONS
AG1 = round(AG/(1+n),1)
G1G2 = round(n*x/(1+n),2)
W = l**2*w*(l/2)
h1 = 32. #in
BK = h1/2
GK = 10. #in
G1K = (AG+GK)-AG1
BG1 = BK-G1K
BM = (l**4./12)*2.*12/(l**3*BK*n)
G1M = BM+BG1
o = G1G2/G1M
#RESULTS
print 'AG1 = %.1f in.'%AG1
print 'G1G2 = %.2f in.'%G1G2
print 'angle through which the cube will tilt = %.3f in '%(o)