How to find the maximum work that can be extracted by two objects which have variable temperatures $T_1$ and $T_2$ with $T_1 > T_2$?
I've thought that the maximum work obtainable is the one produced by a reversible machine, but since the temperatures are not constant I can't use the efficiency of a Carnot heat engine. In any case I can write $\Delta S = 0$ where $S$ is the entropy. So it becomes:
$\Delta S = 0 \Leftrightarrow \Delta S_1 + \Delta S_2 = 0 \Leftrightarrow \int\frac{\delta Q_1}{T_1} + \int\frac{\delta Q_2}{T_2} = 0$
Which should allow me to find the heat put into the system ($Q_2$) and the one taken out ($Q_1$) and so the maximum work. But both $T_1$ and $T_2$ are variables, plus, I have as unknown the final temperature $T_f$ as well, so I don't how to integrate.
Am I missing something? Any help is appreciated.