# Chapter 2 - Work¶

## Example 1 - Pg 16¶

In [1]:
#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")

Net work done = 39810 ft lb


## Example 2 - Pg 17¶

In [3]:
#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")

Net work done = -13012 ft-lb
The answer is a bit different due to rounding off error in textbook


## Example 3 - Pg 20¶

In [4]:
#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")

Net work done = 6335 ft lb
The answer is a bit different due to rounding off error in textbook