#Initialization of variables
P=500 #psia
T=700 #F
J=778
#calculations
dpds=1490 *144/J
#results
print "dp by ds at constant volume = %d F/ft**3/lbm"%(dpds)
print "The answer is a bit different due to rounding off error in textbook"
from __future__ import division
from math import log
#Initialization of variables
cp=0.25 #Btu/lbm R
T0=520 #R
T1=3460 #R
#calculations
dq=cp*(T0-T1)
ds=cp*log(T0/T1)
dE=dq-T0*ds
eta=dE/dq
#results
print "Thermal efficiency = %.1f percent"%(eta*100)
from __future__ import division
from math import log
#Initialization of variables
cp=0.25 #Btu/lbm R
T0=520 #R
T1=3460 #R
dG=21069 #Btu/lbm
dH=21502 #Btu/lbm
#calculations
dq=cp*(T0-T1)
ds=cp*log(T0/T1)
dE=dq-T0*ds
eta=dE/dq
dw=eta*dH
de=-dG+dw
#results
print "Loss of available energy = %d Btu/lbm"%(de)
print "The answer is a bit different due to rounding off error in textbook"