12: Pipes and Cisterns

Example number 12.1, Page number 12.6

In [1]:
#importing modules
import math
from __future__ import division

#Variable declaration
f=4+(1/2);       #time(hours)
x=1/2;     #time(hours)

#Calculation
E=f*(1+(f/x));      #time taken by leak to empty the cistern(hours)

#Result
print "time taken by leak to empty the cistern is",E,"hours"
time taken by leak to empty the cistern is 45.0 hours

Example number 12.2, Page number 12.6

In [2]:
#importing modules
import math
from __future__ import division

#Variable declaration
x=32/60;     #time(hours)
f1=14;    #time for 1st pipe(hours)
f2=16;    #time for 2nd pipe(hours)

#Calculation
T=f1*f2/(f1+f2);      #time(h)
E=T*(1+(T/x));      #time taken by leak to empty the cistern(hours)

#Result
print "time taken by leak to empty the cistern is",E,"hours"
time taken by leak to empty the cistern is 112.0 hours

Example number 12.3, Page number 12.6

In [3]:
#importing modules
import math
from __future__ import division

#Variable declaration
f1=20;    #time for 1st pipe(minutes)
f2=30;    #time for 2nd pipe(minutes)

#Calculation
T=f1*f2/(f1+f2);      #total time to fill(minutes)

#Result
print "total time to fill is",T,"minutes"
total time to fill is 12.0 minutes

Example number 12.4, Page number 12.6

In [4]:
#importing modules
import math
from __future__ import division

#Variable declaration
f=25;     #time(minutes)
e=50;     #time(minutes)

#Calculation
Et=1/((1/f)-(1/e));       #fill or empty time(minutes)

#Result
print "fill or empty time is",Et,"minutes"
print "answer given in the book is wrong"
fill or empty time is 50.0 minutes
answer given in the book is wrong

Example number 12.5, Page number 12.7

In [5]:
#importing modules
import math
from __future__ import division

#Variable declaration
x1=3/4;    #part of cistern
x2=1/2;    #part of cistern
f1=12;     #time to fill(minutes)

#Calculation
f2=f1*x2/x1;    #time to fill(minutes)

#Result
print "time to fill half the cistern is",f2,"minutes"
time to fill half the cistern is 8.0 minutes

Example number 12.6, Page number 12.7

In [8]:
#importing modules
import math
from __future__ import division
from fractions import Fraction

#Variable declaration
e1=20;     #time(minutes)
e2=9;      #time(minutes)
y1=5/6;    #part of cistern

#Calculation
y2=e2*y1/e1;    #part of cistern to be emptied

#Result
print "part of cistern to be emptied is",Fraction(y2)
 part of cistern to be emptied is 3/8

Example number 12.7, Page number 12.7

In [9]:
#importing modules
import math
from __future__ import division

#Variable declaration
a1=3;     #time(minutes)
a2=15;    #time(minutes)
b=10;     #time(minutes)

#Calculation
T=b*(1-(a1/a2));     #time to fill the cistern(minutes)

#Result
print "time to fill the cistern is",T,"minutes"
time to fill the cistern is 8.0 minutes

Example number 12.8, Page number 12.7

In [13]:
#importing modules
import math
from __future__ import division

#Variable declaration
At=12;     #alone fill time of A(minutes)
Bt=16;     #alone fill time of B(minutes)
t=4;      #time(minutes)

#Calculation
l=At*Bt/gcd(At,Bt);     #lcm of At and Bt
a=l/At;
b=l/Bt;
T=(l+(t*a))/(a+b);      #time to fill the cistern(minutes)

#Result
print "time to fill the cistern is",round(T,3),"minutes"
time to fill the cistern is 9.143 minutes

Example number 12.9, Page number 12.7

In [15]:
#importing modules
import math
from __future__ import division
from fractions import gcd

#Variable declaration
At=10;    #time to fill cistern for A(minutes)
Bt=15;    #time to fill cistern for B(minutes)
Ct=5;     #time to empty cistern for C(minutes)
t=4;      #time(minutes)

#Calculation
l1=At*Bt/gcd(At,Bt);     #lcm of At and Bt
l=l1*Ct/gcd(l1,Ct);     #lcm of At,Ct and Bt
a=l/At;
b=l/Bt;
c=l/Ct;
T=(-(t*a)-(t*b))/(a+b-c);     #time to empty the cistern(minutes)

#Result
print "time to fill the cistern is",T,"minutes"
time to fill the cistern is 20.0 minutes

Example number 12.10, Page number 12.8

In [16]:
#importing modules
import math
from __future__ import division
from fractions import gcd

#Variable declaration
At=3;    #time to fill cistern for A(minutes)
Bt=6;    #time to fill cistern for B(minutes)
Ct=4;     #time to empty cistern for B(minutes)
t=2;      #time(minutes)

#Calculation
x=1+(t/Ct);
l=At*Bt/gcd(At,Bt);     #lcm of At and Bt
a=l/At;
b=l/Bt;
T=x*l/(a+b);     #time to fill the cistern(minutes)

#Result
print "time to fill the cistern is",T,"minutes"
time to fill the cistern is 3.0 minutes

Example number 12.11, Page number 12.8

In [17]:
#importing modules
import math
from __future__ import division

#Variable declaration
f1=20;    #time for 1st pipe(hours)
f2=30;    #time for 2nd pipe(hours)

#Calculation
F=f1*f2/(f1+f2);      
T=F+(F/3);      #total time to fill(hours)


#Result
print "total time to fill is",T,"hours"
total time to fill is 16.0 hours

Example number 12.12, Page number 12.8

In [19]:
#importing modules
import math
from __future__ import division

#Variable declaration
f1=15;    #time for 1st pipe(hours)
f2=10;    #time for 2nd pipe(hours)
p=7;     #capacity of carrying(litres/min)
E=2*60;    #time(minutes)

#Calculation
c=p/((1/f1)+(1/f2)+(1/E));      #capacity of cistern(litres)

#Result
print "capacity of cistern is",c,"litres"
capacity of cistern is 40.0 litres

Example number 12.13, Page number 12.9

In [20]:
#importing modules
import math
from __future__ import division

#Variable declaration
ta=6;    #fraction of time for A
t=21;    #time to fill for B(minutes)

#Calculation
F=t/(1+ta);    #time to fill the cistern(minutes)

#Result
print "time to fill the cistern is",F,"minutes"
time to fill the cistern is 3.0 minutes

Example number 12.14, Page number 12.9

In [21]:
#importing modules
import math
from __future__ import division

#Variable declaration
K=4;     #time(minutes)
L=30;   #time(minutes)

#Calculation
F=K*L/(K**2-1);      #time to fill the cistern(minutes)

#Result
print "time to fill the cistern is",F,"minutes"
time to fill the cistern is 8.0 minutes

Example number 12.15, Page number 12.9

In [22]:
#importing modules
import math
from __future__ import division

#Variable declaration
f1=10;    #time for 1st pipe(minutes)
f2=15;    #time for 2nd pipe(minutes)
tex=2;    #extra time taken to fill(minutes)

#Calculation
T=f1*f2/(f1+f2);      #total time to fill(minutes)
E=T**2/tex;     #total time to empty the cistern(minutes)

#Result
print "total time to empty the cistern is",E,"minutes"
total time to empty the cistern is 18.0 minutes

Example number 12.16, Page number 12.9

In [23]:
#importing modules
import math
from __future__ import division

#Variable declaration
f=9;    #fill rate(hours)
e=6;    #empty rate(hours)
F=9;    #total time(hours)

#Calculation
a=(1/F)+1;
nf=a*f*e/(f+e);      #number of filling pipes

#Result
print "number of filling pipes are",nf
number of filling pipes are 4.0

Example number 12.17, Page number 12.10

In [24]:
#importing modules
import math
from __future__ import division

#Variable declaration
ra=2/6;    #rate of admission of water(tonnes/min)
rp=12/60;    #rate of pumping out water(tonnes/min)
q=80;    #quantity of water(tonnes)
d=55;    #distance(km)

#Calculation
r=ra-rp;     #rate of accumulation(tonnes/min)
T=q/(r*60);      #time to accumulate water(hours)
Asr=d/T;    #average sailing rate(km/h)

#Result
print "average sailing rate is",Asr,"km/h"
average sailing rate is 5.5 km/h

Example number 12.18, Page number 12.10

In [25]:
#importing modules
import math
from __future__ import division

#Variable declaration
p1=7/8;     #part1
p2=5/6;     #part2
t1=12;      #time(minutes)
t2=16;      #time(minutes)
t=3;     #time(minutes)

#Calculation
a=(p1/t1)+(p2/t2);
b=1-(t/t1)-(t/t2);
x=b/a;     #time before the full flow began(minutes)

#Result
print "time before the full flow began is",x,"minutes"
time before the full flow began is 4.5 minutes