#find the area piston for given parameters
#given
a=3.
#diameter squared
#calculation
A=0.785*3**2
print"%s %.2f %s"%("area of piston ",A,"")
#given
#find the area of piston and displacement of that piston
a=3.
b=4.
A=0.785*3**2
print"%s %.2f %s"%("area of piston ",A,"")
D=A*b
#by using above results
print"%s %.2f %s"%("displacement of piston ",D,"cu in")
#given
#find the piston speed
pa=9.
S=1600.
#average piston velocity =distance traveld/time to travel
#first divide by 1 min and u will get same result late divide by 12 because to express per minute
Ps=(pa*S)/(12.)
print"%s %.2f %s"%("piston speed ",Ps,"ft per min")
#given
#compute the average acceleration `
#pressure= force/area
#first express the velocity in ft per sec.time
t=5.
v=9000.
Min=(9000./60.)
Aa=(Min/t)
print"%s %.2f %s"%("average acceleration",Aa,"ft per sec^2")
#compute the pressure force
#given
w=12000.
p=6.
a=10**2
f=p*a
P=w/f
print"%s %.2f %s"%("pressure ",P,"Psi")
#given
#compute the gas force action on pistion
#use the figure to compute it
p=500.
D=5**2
#force=pressure*area
area=0.785*D
F=p*area
print"%s %.2f %s"%("force ",F,"lb")
#given
#find the ratio of weight of certain volume
Oil=1*8.34
g=0.89
#weight of the oil equal to weight of 1 gal
w=Oil*g
print"%s %.2f %s"%("wegiht of gal ",w,"lb per gal")
#given
#find out what is mass of an engine piston that wieghs
w=55.
#mass weight divide by 32.2
#because it convets to lb
M=w/32.2
print"%s %.2f %s"%("mass of an engine",M,"lb")
#find the work neccasry to raise a weight
#given
import math
w=150.
d=8.
Work=w*d
print"%s %.2f %s"%("work necesary ",Work,"ft-lb")
#given
#find out power required to do in three cases:
import math
w=150.
d=8.
Work=w*d
print"%s %.2f %s"%("work necesary ",Work,"ft-lb")
#case(1)
t1=2.
power=Work/t1
Horsepower=power/550.
print"%s %.2f %s"%("powe requiered for time ",power,"ft-lb")
#case(2)
t2=8.
power=Work/t2
Horsepower=power/550.
print"%s %.2f %s"%("for power requiered at t2 ",power,"ft-lb per sec")
#find the electric generator to takes 150 kn
#given
import math
g=150.
a=1.341
p=g*a
print"%s %.2f %s"%("equilient horse power",p,"hp")
#find the work done by exhaust gases
#given
import math
w=500.
v1=9000.
v2=5400.
t=60.
V1=v1/t
V2=v2/t
hp=32.2
KE1=(1/2.)*(500/32.2)*(150**2)
KE2=(1/2.)*(500/32.2)*(90**2)
W=KE1-KE2
print"%s %.2f %s"%("workdone",W,"ft-lb")
#answer is wrong in textbook