import math
#initialisation of variables
M = 31*10 #lbs
P = 3.6 #lbs
t = 60. #sec
g = 32.2 #ft/sec**2
H = 9. #ft
d = 1. #in
w = 6.24 #gallons
#CALCULATIONS
v = P*g*t/M
V = math.sqrt(2*g*H)
Cv = v/V
V1 = math.pi*(d/12)**2*V*60*w/4
Cd = M/(10*V1)
Cc = Cd/Cv
Cr = (1/Cv**2)-1
#RESULTS
print 'Coefficient of resistance = %.2f '%(Cr)
# rounding off error
import math
#initialisation of variables
M = 1.65 #lbs
Q = 31. #gallons per min
d = 1. #in
h = 4. #ft
t = 60. #sec
g = 32.2 #ft/sec**2
Q1 = 6.24 #gallons per min
c = 0.36
P = 3.6 # lbs
H = 9.
#CALCULATIONS
v = P*g*t/(Q*10)
V = math.sqrt(2*g*H)
Cv = (v/V)
vf = V*math.pi*(d/12)**2*60*Q1/4
Cd = Q/vf
Cc = Cd/Cv
Cr = (1/Cv**2)-1
#RESULTS
print 'velocity of jet = %.2f ft/sec'%(v)
print 'theoretical velocity of jet = %.2f ft/sec'%(V)
print 'Cv = %.2f '%(Cv)
print 'volume flow = %.2f gallons per minute'%(vf)
print 'Cd = %.2f '%(Cd)
print 'Cc = %.2f '%(Cc)
print 'Coefficient of resistance = %.2f '%(Cr)
# Note : Answer for theoretical velocity is wrong in book. Please check.
import math
#initialisation of variables
x = 11.5 #in
y = 1.2 #in
H = 29. #in
q = 6.24 #gallons per minute
d = 1. #in
g = 32.2 #ft/sec**2
Q = 16. #gallons per min
#CALCULATIONS
Cv = math.sqrt(x**2/(4*H*y))
Q1 = math.pi*(d/12)**2*math.sqrt(2*g*H/12)*q*60/4
Cd = Q/Q1
Cc = Cd/Cv
Cr = (1/Cv**2)-1
#RESULTS
print 'Coefficient of resistance = %.2f '%(Cr)
# rounding off error.
import math
#initialisation of variables
x = 3.2 #ft
d = 8. #ft
W = 5.12 #lb
A = 1./144
H = 4. #ft
g = 32.2 #ft/sec**2
Q = 251.5 #lbs/min
w = 62.4 #lbs/ft**2
#CALCULATIONS
F = W*x/d
v = W*x*g*60/(d*Q)
V = math.sqrt(2*g*H)
Cv = v/V
Q1 = A*V*60*w
Cd = Q/Q1
Cc = Cd/Cv
#RESULTS
print 'Cc = %.2f '%(Cc)
import math
#initialisation of variables
d = 8. #in
#CALCULATIONS
Cd = 1/math.sqrt(1+((1./(8.**2/100)))-1)
area = math.pi/4 * (2./12)**2
Discharge = area * Cd * math.sqrt(2*32.2*4)
#RESULTS
print 'Cd = %.2f '%(Cd)
print "Discharge = %.1f cubic ft./sec."%Discharge
# note : rounding off error. please check.
import math
#initialisation of variables
d =2. #in
h = 6. #ft
H = 26. #ft
g = 32.2 #ft/sec**2
R = 6.
#CALCULATIONS
v2 = math.sqrt(2*g*(H+h))
Q = math.pi*(d/12)**2*v2/4
v3 = math.sqrt(2*g*h)
r = v2/v3
d3 = math.sqrt(r*d**2)
v4 = math.sqrt(v2**2/R)
d4 = math.sqrt(d**2*(v2/v4))
#RESULTS
print 'diameter = %.2f in'%(d4)
import math
#initialisation of variables
r = 9./16
r1 = 7./16
h = 26. #ft
#CALCULATIONS
r2 = 1/((r**2)+(0.25*r1**2))
H1 = h/(r2-1)
#RESULTS
print 'maximu head of the tank = %.3f ft of water'%(H1)
# rounding off error
# variables
A = 30.*15 # sq ft
a = 2. # sq ft
H1 = 5. # ft
H2 = 0.
# calculation
T = a*A*H1**(1./2)/(.62*a*8.02)
# result
print "Time of emptying pool : T = %.1f seconds"%T
# rounding off error
import math
#initialisation of variables
H1 = 9. #ft
A = 2. #ft**2
H2 = 4. #ft
d = 2.25 #in
t = 60. #sec
g = 32.2 #ft/sec**2
#CALCULATIONS
a = (d/12)**2
Cd = (2*A*(H1-H2)**0.5)/(t*a*math.sqrt(2*g))
#RESULTS
print 'coefficient of dicharge = %.3f '%(Cd)
#ANSWER GIVEN IN THE TEXTBBOK IS WRONG..VERIFIED WITH CALCULATOR
import math
#initialisation of variables
d = 1. #ft
h1 = 10. #ft
h2 = 2. #ft
Cd = 0.6
g = 32.2 #ft/sec**2
t = 12.6
#CALCULATIONS
A = math.pi*d**2/4
a = 1./144
T1 = (A/(a*Cd*math.sqrt(2*g)))*(1./3)*(h1**1.5-(h1-h2)**1.5-h2**1.5)+t
T2 = 2*A*(h2**0.5)/(Cd*a*math.sqrt(2*g))
T = T1+T2
#RESULTS
print 'Total time = %.2f sec'%(T)
import math
from scipy.integrate import quad
#initialisation of variables
l = 600. #ft
w = 400. #ft
s = 1.
h = 20. #ft
d = 3. #ft
dh = 10. #ft
Cd = 0.7
g = 32.2 #ft/sec**2
k = 240000.
k1 = 2000.
k2 = 4.
#CALCULATIONS
def f(x):
return (k/math.sqrt(x) + k1*math.sqrt(x) + k2*x**(3./2))
T1 = 1./(Cd * math.pi/4 * 9 * 8.02) * quad(f,10,20)[0]
#RESULTS
print 'Time taken for 10 feet fall = %.f sec'%(T1)
# note : quad() gives accurate answer. so answer is slightly different.
import math
#initialisation of variables
Cd = 0.6
H1 = 8. #ft
H2 = 3. #ft
l = 90. #ft
b = 30. #ft
g = 32.2 #ft/sec**2
A = 2. #ft**2
#CALCULATIONS
T1 = 2*l*b*(H1**0.5-(H1-H2)**0.5)/(Cd*math.sqrt(2*g)*A)
T2 = (l*b*2/10)*(2./3)*(H1-H2)**1.5/(Cd*math.sqrt(2*g)*A)
T = T1+T2
#RESULTS
print 'Time it take to emptify the swimming bath = %.1f sec'%(T)
# rounding off error
import math
#initialisation of variables
Cd = 0.8
g = 32.2 #f/sec**2
d = 3. #in
x = 6. #ft
l = 25. #ft
d1 = 8. #ft
#CALCULATIONS
A = math.pi*(d/12)**2/4
T = (2*l/(Cd*A*math.sqrt(2*g)))*(-2./3)*((d1-x)**1.5-d1**1.5)
#RESULTS
print 'Time it take to emptify the boiler = %.f sec'%(T+6)
import math
#initialisation of variables
l = 30. #ft
w = 10. #ft
d = 4. #in
h1 = 10. #ft
h2 = 2. #ft
Cd = 0.97
g = 32.2 #ft/sec**2
#CALCULATIONS
A1 = w*3*l/4
A2 = l*w/4
A = math.pi*(d/12)**2/4
T = 2*A1*(math.sqrt(h1)-math.sqrt(h2))*10/(Cd*A*math.sqrt(2*g)*(l+w))
#RESULTS
print 'Time it take to reduce the height = %.f sec'%(round(T,-1))
import math
#initialisation of variables
A1 = 1000. #ft**2
A2 = 1000. #ft**2
a = 2. #ft**2
H1 = 9. #ft
H2 = 4. #ft
Cd =0.8
g = 32.2 #ft/sec**2
#CALCULATIONS
T = a*1000*(math.sqrt(H1)-math.sqrt(H2))/(Cd*a**2*math.sqrt(2*g))
#RESULTS
print 'Time it take to reduce the height = %.1f sec'%(T)
# rounding off error
import math
#initialisation of variables
l = 70. #ft
b = 10. #ft
Hl = 10. #ft
H1 = 6. #ft
h1 = 4. #ft
h2 = 2. #ft
w = 2. #ft
h3 = 3. #ft
Cd = 0.6
g = 32.2 #ft/sec**2
#CALCULATIONS
t = (l*b)*(Hl+H1)/(Cd*h2*w*h1*math.sqrt(2*g*H1))
t1 = 2*l*b*math.sqrt(Hl)/(Cd*h2*w*h3*math.sqrt(2*g))
#RESULTS
# 2nd ans is wrong in book
print 'Time of filling = %.2f sec'%(t)
print ' Time of emptying = %.2f sec'%(t1)
import math
from sympy import Symbol,solve
#initialisation of variables
HL = 12.5 #ft
H1 = 10.5 #ft
Cd = 0.62
h = 4. #ft
l = 3. #ft
n = 2.
t = 5. #min
g = 32.2 #ft/sec**2
#CALCULATIONS
a1 = n*l*l
A = Symbol('A')
ans = solve( (2*A/(Cd*a1*26)) + 2*A*math.sqrt(H1)/(Cd*a1*8.02) - 300 )
A = ans[0]
#RESULTS
print 'Area = %.f sq ft'%(A)
# rounding off error
import math
#initialisation of variables
Cd = 0.62
g = 32.2 #ft/sec**2
l = 200. #ft
w = 25. #ft
a1 = 5. #ft**2
h = 20. #ft
#CALCULATIONS
t = 2*l*w*math.sqrt(h-(h/a1))/(Cd*math.sqrt(2*g)*a1)
#RESULTS
print 'tme rquired to fill the lock = %.f sec'%(t)
# rounding off error
import math
#initialisation of variables
L = 150. #ft
w = 20. #ft
t = 5. #min
h = 5. #ft
Cd = 0.6
Hl = 9. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
T = 2*L*w*math.sqrt(Hl)/(Cd*t*60*math.sqrt(2*g))
#RESULTS
print 'Area of sumberged slice = %.1f sq ft'%(T)
import math
#initialisation of variables
L = 3. #ft
H1 = 1.5 #ft
H2 = 0.75 #ft
Cd = 0.62
g = 32.2 #ft/sec**2
#CALCULATIONS
Q = 2*Cd*60*L*math.sqrt(2*g)*(H1**1.5-H2**1.5)/3
#RESULTS
print 'Discharge per minute = %.1f cubic ft per minute'%(Q)
import math
#initialisation of variables
Cd = 0.62
H1 = 6. #ft
H2 = 3. #ft
H = 4. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
Q1 = 2*Cd*H*math.sqrt(2*g)*(H**1.5-H2**1.5)/3
Q2 = Cd*H*(H1-H)*math.sqrt(2*g*H)
Q = Q1+Q2
#RESULTS
print 'Total discharge = %.f cuses'%(Q)