In [1]:

```
# Variables
t2 = 300; #temperature of the math.sink in K
n1 = 0.4; #efficiency of the engine
n2 = 0.6; #efficiency of the engine
# Calculations
t1 = t2/(1-n1); #temperature of the source in K
t3 = t2/(1-n2); #temperature of the source in K
# Result
print 'the temperature of the source when 0.4 efficiency is %3.2f K \
\nthe temperature of the source when 0.6 efficiency is %3.2f K'%(t1,t3)
```

In [3]:

```
# Variables
t2 = 273.; #temperature of the math.sink in K
t1 = 373.; #temperature of the source in K
q1 = 840.; #heat supplied in joules
j = 4.2; #joukes constant in erg/cal
# Calculations
w = (q1/t1)*(t1-t2); #work done in joules
q2 = (q1/j)*(t2/t1); #heat rejected in calories
n = 1-(t2/t1); #efficiency of the engine
# Result
print 'work done is %3.f j \
\nheat rejected is %3.f cal \
\nthe efficiency of the engine is %3.1f %%'%(w,q2,n*100)
```

In [4]:

```
# Variables
t1 = 90.; #temperature of the oxygen boils in K
t2 = 20.; #temperature of the liquid hydrogen in K
t3 = 300.; #temperature of the sink in K
# Calculations
n = (t1-t2)/t1; #efficiency of the engine
t4 = t3/(1-n); #temperature of the source in K
# Result
print 'the efficiency of the engine is %3.2f \
\nthe temperature of the source is %3.2f K'%(n,t4)
```

In [6]:

```
# Variables
t1 = 373.; #temperature of the source in K
t2 = 273.; #temperature of the sink in K
w = 1200*10**5*980; #work done in ergs
j = 4.18*10**7; #joules constant in ergs/cal
# Calculations
q = (w/j)*(t1/(t1-t2)); #heat added in cal
# Result
print 'the heat added is %3.2f cal'%(round(q,-1))
```

In [12]:

```
# Variables
t1 = 273.; #temperature of the source in K
t2 = 290.; #temperature of the sink in K
l = 8*10.**11; #latent of fusion in ergs/cal
# Calculations
n = (t2-t1)/t1; #efficiency of the engine
w = n*l; #energy to be supplied in ergs
# Result
print 'efficiency of the engine is %.2f %% \
\nenergy to be supplied is %.3e ergs'%(n*100,w)
print "Note: answer in book are wrong please calculate manually."
```

In [14]:

```
# Variables
t1 = 373; #temperature in K
t2 = 273; #temperature of math.sink in K
q = 10**4; #heat taken at higher temperature in cal
j = 4.2*10**7; #joules consmath.tant in ergs/cal
# Calculations
w = q*j*(t1-t2)/t1; #work done in ergs
# Result
print 'work done is %.1e ergs'%(w)
```

In [23]:

```
import math
# Variables
p = 100*746/4.2; #power developed in cal/sec
t1 = 300.; #temperature of the sink in K
t2 = 500.
# Calculations
te = 1 - (t1/t2)
Q1 = p * 100/40 # heat supplied
Q2 = Q1 * 0.6
# Result
print "Thermal efficiency = %.f %%"%(te*100)
print "Power developed by the engine %.2f calories/sec"%p
print "If Q1 heat supplied , Q1 = %.2e cal/sec"%Q1
print "Q2 = %.2e cal/sec"%Q2
```

In [34]:

```
import math
# Variables
l = 964.8; #latent heat of steam in B.Th.U per lb
q = 4*15*l*778; #heat developed in ft lbs
w = 30000*60; #work done is ft lbs
pv = 12*1.013*10**6*10**3
T = 600 # K
# Calculations
n = (w/q)*100; #efficiency of the engine
p = 100-n; #percentage of heat wasted
T2 = 600./(6**.4)
R = pv/T
W = R * (T - T2) * 2.303 * math.log10(6)
e = 1 - (T2/T)
# Result
print "Lowest temperature T2 = %.f K"%T2
print "Work done W = %.2e ergs"%W
print "Efficiency = %.1f %%"%(e*100)
```

In [49]:

```
# Variables
l=964.8; #latent heat of steam in B.Th.U per lb
q=4*15*l*778; #heat developed in ft lbs
w=33000*60; #work done is ft lbs
#CALCULATIONS
n=(w/q)*100; #efficiency of the engine
p=100-n; #percentage of heat wasted
# Results
print ('the percentage of the heat wasted is %3.2f'%p)
```

In [4]:

```
# Variables
ip = 16.3*500*778/33000; # Variables power of the engine in HP
me = 0.72; #mechanical efficiency of the engine
bhp = 31; #brake horse power in b.h.p
ihp = bhp/me; #indicated horse power in HP
# Calculations
i = ihp/ip; #indicated thermal efficiency
# Result
print 'the indicted thermal efficiency is %3.2f %%'%(i*100)
```

In [5]:

```
# Variables
p = 200.; #horse power of steam engine in lbs coal per hour
j = 770.; #joules constant in ft lbs per B.Th.U
# Calculations
w = 12500*p*j; #equivalent work in ft.lb.per.hr
hp = w/(60*33000); #horse power
# Result
print 'horse power of the engine is %3.2f'%(hp)
print "Note : answer in book is wrong. Please check manually."
```

In [43]:

```
# Variables
t1 = 340.; #temperature of the atmosphere in K
t2 = 612.; #temperature of the compression stroke in K
y = 1.39; #adiabatic expansion
t3 = 2040.; #temperature after consmtant volume ignition in K
# Calculations
d = (t2/t1)**(1/(y-1)) #density in gm/cc
n = 1-(1/d)**(y-1); #efficiency of the engine
p = ((d)**(y))*(t3/t2); #maximum temperature of the temperature in atm
# Result
print 'the maximum pressure of the engine is %3.f atm'%(p)
```

In [40]:

```
# Variables
t1 = 915; #temperature at the beggining in K
t2 = 2040; #temperature at the end in K
d = 12.6; #adiabatic expansion ratio
y = 1.39; #coefficent of expansion
# Calculations
x = t2/t1 #ratio temparatures
n = 1-(1/d)**(y-1)*((x**y)-1)/(y*(x-1)); #efficiency of the engine
# Result
print 'the efficiency of the engine is %3.3f'%(n)
print "Note : answer slighty different because of rounding error"
```

In [6]:

```
# Variables
p1 = 15.; #intial pressure in lb/sq.inch
dv = 15.; #ratio of intial to final volume
t1 = 520.; #temperature at intial in K
y = 1.4; #coefficient of expansion
# Calculations
p2 = p1*(dv)**(y); #final pressure in lb/sq.inch
t2 = t1*(dv)**(y-1); #final temperatire in K
# Result
print 'the final pressure is %3.2f lb/sq.inch \
\nthe final temperature is %.f K'%(p2,t2)
```