Solution (source code)

= Solution

The complete cycle must be a <reversible thermodynamic process>: no <friction>, viscous dissipation, unrestrained expansion, or other source of <entropy>. Each moving boundary must be arbitrarily close to <mechanical equilibrium>. <Heat transfer> to or from a bath must occur across an infinitesimal <temperature> difference, and the insulated stages must be genuinely <adiabatic processes>. There must also be no direct <heat> leak between the <heat baths>.

For an engine exchanging <heat> only with these two <heat baths>, the <Second law of thermodynamics> gives
$$
S_{\rm gen}=\frac{Q_c}{T_c}-\frac{Q_h}{T_h}\geq0,
$$
and thus
$$
\eta=1-\frac{T_c}{T_h}-\frac{T_cS_{\rm gen}}{Q_h}\leq\eta_{\rm Carnot}.
$$
Practical engines generate <entropy> through finite <temperature> differences, <friction> and other dissipative effects. They therefore fall below the <Carnot cycle> limit. Approaching reversible <heat> exchange generally requires vanishingly slow operation for a finite heat-transfer apparatus, limiting useful <power>.