import math
#initialisation of variables
i = 1./4500
w =3. #ft
d = 3. #ft
k = 0.003
g = 32.2 #ft/sec**2
#CALCULATIONS
A = 0.5*math.pi*d**2/4
P = math.pi*d/2
m = A/P
f = k*(1+(0.1/m))
C = math.sqrt(2*g/f)
V = C*math.sqrt(m*i)
Q = A*V
#RESULTS
print 'Discharge = %.2f cuses'%(Q)
import math
#initialisation of variables
b = 40. #ft
d = 4. #ft
k = 0.004
g = 32.2 #ft/sec**2
Q = 500. #cuses
#CALCULATIONS
A = b*d
P = b+2*d
m = A/P
f = k*math.sqrt(1+(0.2/m))
C = math.sqrt(2*g/f)
V = Q/A
i = V**2/(C**2*m)
D = 5280*i
#RESULTS
print 'fall in feet per mile = %.1f ft'%(D)
# rounding off error
import math
#initialisation of variables
b = 40. #ft
d = 4. #ft
n = 1.
k = 0.005
i = 1./3250
g = 32.2 #ft/sec**2
#CALCULATIONS
A = (b+d)*d
P = round(b+2*d*math.sqrt(n**2+1),2)
m = round(A/P,2)
f = k*(1+(0.8/m))
C = round(math.sqrt(2*g/f),2)
V = C*math.sqrt(m*i)
Q = V*A
#RESULTS
print 'Discharge = %.f cuses'%(Q)
# book answer is wrong. please check.
import math
#initialisation of variables
Q = 400. #cuses
V = 2. #ft/sec
d = 3. #ft
n = 1.
g = 32.2 #ft/sec**2
#CALCULATIONS
A = Q/V
w = A/d
W = w-d
P = W+2*d*math.sqrt(n**2+1)
m = A/P
f = 0.006*(1+(4/m))
C = math.sqrt(2*g/f)
i = (V/C)**2/m
#RESULTS
print ' slope = %.5f '%(i)
#ANSWER IN TEXTBOOK IS NOT GIVEN IN DECIMALS
import math
#initialisation of variables
Q = 600. #cuses
V = 3. #ft/sec
n = 1.
i = 1./3200
C = 80.
d = 6. #ft
#CALCULATIONS
A = Q/V
m = V**2/(C**2*i)
b = (A/d)-d
#RESULTS
print 'width = %.1f ft'%(b)
#initialisation of variables
Q = 20. #gallons / day
i = 50000. #inhabitants
p = 10. #percent
t = 24. #hrs
T = 0.25 #in
a = 2000. #acres
#CALCULATIONS
q = Q*i*p/(100*60*60*6.24)
A = T*43560*a/12
Q1 = A/(t*60*60)
Q2 = q+Q1
#RESULTS
print 'total discharge = %.2f cuses'%(Q2)
import math
#initialisation of variables
Q = 400. #cuses
V = 8. #ft/sec
C = 150.
#CALCULATIONS
A = Q/V
d = math.sqrt(A/2)
i = V**2/(C**2*(d/2))
#RESULTS
print 'slope %.4f '%(i)
import math
#initialisation of variables
Q = 100. #cuses
V = 2. #ft/sec
n = 1.5
k = 0.006
g = 32.2 #ft/sec**2
#CALCULATIONS
A = Q/V
d = math.sqrt(A/((2*math.sqrt(n**2+1))-n))
m = A/d
mb = m-n*d
bt = m+n*d
m1 = d/2
f = k*(1+(4/m1))
C = math.sqrt(2*g/f)
i = V**2/(C**2*m1)
#RESULTS
print 'slope %.5f '%(i)
import math
#initialisation of variables
i = 1./1000
d = 4. #ft
C = 125.
k = 0.95
o = 5.372
#CALCULATIONS
h = k*d
A = d**2*(o- math.sin(math.radians(o*180/math.pi)))/8
P = (d/2)*o
m = A/P
V = C*math.sqrt(m*i)
Q = V*A
#RESULTS
print 'Discharge = %.2f cuses'%(Q)
#initialisation of variables
Cd = 0.95
m = 300. #ft
V = 8. #ft/sec
d = 6. #ft
n = 6.
s = 40. #ft
g = 32.2 #ft/sec**2
dh = 0.11
#CALCULATIONS
h = (V**2/(g+(d/3)))*(1.1*(m/(s*n))**2-1)
h1 = (V**2/(2*g))*(1.1*(m/(s*n))**2-(d/(s/n)))+dh
#RESULTS
print 'afflux upstream = %.2f ft'%(h1)
import math
#initialisation of variables
V = 8. #ft/sec
g = 32.2 #ft/sec**2
d = 10. #ft
l = 2. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
a = math.sqrt(((l*g*l/V**2)+(d/12)**2)/1.1)
V1 = V*d/12
va = math.sqrt(2*g*0.69)
v1 = math.sqrt(2*g*(l+0.69))
#RESULTS
print 'total head producing velocity = %.1f ft/sec'%(v1)
import math
#initialisation of variables
d = 8. #ft
V = 6. #ft/sec
g = 32. #ft/sec**2
#CALCULATIONS
h = (V*d/4)**2/g
#d2 = (-4/2)+math.sqrt((2*(d/2)*(V*(d/2))/g)+((d/2)**2/4))
d2 = round((-4./2) + math.sqrt(2*4*12**2/g + 4**2/4. ),3)
x = (d/2)/d2
l = ((1/(x**1.5))-1)**0.81
Lw = l*(d/2)*10.3
#RESULTS
print 'height of standing wave = %.1f ft'%(Lw)
# note : answer are different because of rounding off error. this answer is accurate.
import math
#initialisation of variables
w = 9. #in
wc = 6. #in
d = 8. #in
g = 32.2 #ft/sec**2
#CALCULATIONS
Q = 3.09*(wc/12)*(d/12)**1.5
V = Q*144/(w*d)
H = (d/12)+(V**2/(2*g))
Q = 3.09*(wc/12)*H**1.5
#RESULTS
print 'Discharge = %.2f cuses'%(Q)
import math
from sympy import Symbol,solve
#initialisation of variables
i = 1./6400
b = 40. #ft
d = 5. #ft
C = 140.
h = 6. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
A = b*d
P = b+2*d
m = A/P
v = C*math.sqrt(m*i)
V = v*(d/h)
Q = v*b*d
x = h-(Q/(3.09*(b/2)))**(2./3)-(V**2/(2*g))
#RESULTS
print 'height of pump = %.2f ft'%(x)
# rounding off error. please check.
import math
#initialisation of variables
w = 40. #ft
h = 5. #ft
P =50. # lb/ft**2
i = 1./6400
h1 = 10. #ft
H = 100. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
m = w*h/P
v = 140*math.sqrt(m*i)
v1 = v*h/h1
h2 = w*h1/(H-w)
a = v1**2/(140**2*h2)
s = (i-a)*1000/(1-(v1**2/(g*h1)))
dh = h1-s
#RESULTS
print 'depth of water = %.3f ft'%(dh)
import math
#initialisation of variables
h = 9. #ft
h1 = 9.5 #ft
i = round(1./6400,6)
h2 = 40. #ft
h3 = 59. #ft
h4 = 5. #ft
g = 32.2 #ft/sec**2
#CALCULATIONS
m = round(h2*h1/h3,1)
v = 3.5 * h4/h1 #140*math.sqrt(m*i)*(h4/h1)
a = round(v**2/(140**2*m),6)
s = (i-a)/(1-0.11)
x = 1/s
#RESULTS
print 'distance upstream from the dam = %.f ft'%(x)
# answer is different because value of s is 0.000156 and in book it is taken as 0.00013 so rounding off error"