import scipy.integrate
#initialization
k = 20 #lb/in
x = 3 #in
#calculation
def fun(x):
y = k*x
return y
w = scipy.integrate.quadrature(fun, 0.0, 3.0)
#result
print "Work done = %d in-lb" %(round(w[0]))
import scipy.integrate
#initialization
w = 0.1 #lbm
Pv = 30000 #ft-lb/lbm
v1 = 14.0 #ft^3 /lbm
v2 = 3.0 #ft^3/lbm
#calculation
def func(v):
W = Pv/v
return W
temp = scipy.integrate.quadrature(func, v1, v2,)
Work = w * temp[0]
#result
#Answer varies a bit from the text due to rounding off of log value
print "Work done = %d ft-lb" %Work
import scipy.integrate
#initialization of variables
T1 = 500.0 #R
T2 = 1000.0 #R
w = 2.0 #lbm
#calculations
def c(T):
cp=0.282+0.00046*T
return cp
Q = scipy.integrate.quadrature(c, T1, T2,)[0]
Heat = Q*w
#results
print "Heat flow = %d B" %(Heat)
import scipy.integrate
#initialization
T1 = 500.0 #R
T2 = 1060.0 #R
w = 1 #lbm
#calculation
def v(T):
cv = 0.258-120/T +40000/T**2
return cv
Q = scipy.integrate.quadrature(v, T1, T2,)[0]
cvm=Q/(T2-T1)
#result
print "The amount of heat: ", round(Q,1), "B/lbm"
print "Mean specific heat = %.3f B/lbm F" %cvm
#initialization
w=1 #lbm
Sw=0.3120 #B/lbm R
Ss=1.7566 #B/lb R
T=672 #R
#calculation
Q=T*(Ss-Sw)
#result
print "Latent heat of water = %d B/lbm" %Q
import scipy.integrate
#initialization
w=1 #lbm
T1=492 #R
T2=672 #R
cp=1 #B/lbm F
#calculation
dQ=cp*(T2-T1)
def ds(T):
s=1/T
return s
entropy = scipy.integrate.quadrature(ds, T1, T2,)[0]
#results
print "Entropy change = ", round(entropy, 3), "B/lbm R"