#Calculate the net work done
#Initialization of variables
from numpy import math
g=1.4 #Gamma
P=100. #psia
V1=3. #cu ft
Pf=20. #psia
#calculations
V2=V1*math.pow((P/Pf),(1/g))
W=(Pf*V2-P*V1)*144./(1-g)
#results
print '%s %d %s' %("Net work done =",W,"ft lb")
#Calculate the net work done
#Initialization of variables
Wb=-33000. #ft-lb
V2=3. #cu ft
V1=1. #cu ft
P=69.4 #psia
#calculations
Wa=P*(V2-V1)*144.
W=Wa+Wb
#results
print '%s %d %s' %("Net work done =",W,"ft-lb")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
#Calculate the net work done
import math
#Initialization of variables
b=11. #in
s=15. #in
l=2.4 #in
k=80. #psi per in
#calculations
a=math.pi*b*b /4
L=s/12.
Pm=1.6/l *k
W=Pm*a*L
#results
print '%s %d %s' %("Net work done =",W,"ft lb")
print '%s' %("The answer is a bit different due to rounding off error in textbook")