(*analytic integrations for a boxcar transmission: get optimal heat engine performance*)

Assuming[ml>mr && bl>br && br>0,Integrate[(w)(1/(Exp[br(w+wb-mr)]+1)-1/(Exp[bl(w+wb-ml)]+1)),{w,0,Infinity}]]

FullSimplify[Assuming[ml>mr && bl>br && br>0,Integrate[(ml-mr)(1/(Exp[br(w+wb-mr)]+1)-1/(Exp[bl(w+wb-ml)]+1)),{w,0,Infinity}]]/.{wb->ml+(ml-mr)br/(bl-br)}]

(((ml-mr) (bl Log[1+(E^((bl br (ml-mr))/(-bl+br)))]-br Log[1+(E^((bl br (-ml+mr))/(bl-br)))]))/(bl br))

powern[ml_,mr_,bl_,br_]:=1/(2Pi) NIntegrate[(ml-mr)(1/(Exp[br(w-mr)]+1)-1/(Exp[bl(w-ml)]+1)),{w,(bl ml- br mr)/(bl-br),Infinity}];
powera[ml_,mr_,bl_,br_]:=1/(2Pi)((bl-br)/(bl br))^2 *(bl br/(bl-br) (ml-mr))*Log[1+Exp[-(bl br/(bl-br) (ml-mr))]];

NMaximize[x Log[1+Exp[-x]],x]
FindMaximum[x Log[1+Exp[-x]],{x,1.,0.1}]

Plot[x Log[1+Exp[-x]],{x,1.14,1.15}]

powern[2.,-2.,10.,1.]
powera[2.,-2.,10.,1.]

efficiencyn[ml_,mr_,bl_,br_]:=NIntegrate[(ml-mr)(1/(Exp[br(w-mr)]+1)-1/(Exp[bl(w-ml)]+1)),{w,(bl ml- br mr)/(bl-br),Infinity}]/NIntegrate[(w-mr)(1/(Exp[br(w-mr)]+1)-1/(Exp[bl(w-ml)]+1)),{w,(bl ml- br mr)/(bl-br),Infinity}];
efficiencya[ml_,mr_,bl_,br_]:=Module[{x},
x = bl br/(bl-br)(ml-mr);
(1-br/bl)*1/(1+(1+br/bl)*(-PolyLog[2,-Exp[-x]]/(x Log[1+Exp[-x]])))
];

efficiencyn[2.,-2.,1000,1.]
efficiencya[2.,-2.,1000,1.]

(*now get optimal cooling performance*)

(*the Pendry bound yields the maximum cooling current that can be obtained from a finite-temperature reservoir, so we set the right Fermi function to zero and position the transmission such that the positive fraction is counted*)
FullSimplify[Assuming[bl>0,1/(2Pi) Integrate[(w-ml)(1/(Exp[bl(w-ml)]+1)),{w,ml,Infinity}]],ml>mr && bl>br && br>0]

Limit[3x^2+(π^2)+6 PolyLog[2,-(E^x)],x->0]
Plot[Which[x>0,3x^2+(π^2)+6 PolyLog[2,-(E^x)],True,-6 PolyLog[2,-(E^x)]],{x,-10,+10},PlotRange->All]

Simplify[((3 (bl^2) (ml^2)+(π^2)+6 ((-((π^2)/6)-(((Log[x])^2)/2))+(1/x)-(1/(4 (x^2)))+(1/(9 (x^3)))))/(12 (bl^2) π))/.{x->Exp[bl ml]},bl>0 && ml>0]

Limit[((3 (bl^2) (ml^2)+(π^2)+6 PolyLog[2,-(E^(bl ml))])/(12 (bl^2) π)),ml->Infinity,Assumptions->bl>0]

(*the cooling current in the considered limit*)
FullSimplify[Assuming[ml>mr && bl>br && br>0,1/(2Pi) Integrate[(w-ml)(1/(Exp[bl(w)]+1)-1/(Exp[br(w+ml-mr)]+1)),{w,ml,ml+br/(bl-br)(ml-mr)}]],ml>mr && bl>br && br>0]

(*the cooling current in the limit mr->-Infinity*)
FullSimplify[Assuming[ml>mr && bl>br && br>0,1/(2Pi) Integrate[(w-ml)(1/(Exp[bl(w)]+1)),{w,ml,Infinity}]],ml>mr && bl>br && br>0]

Series[PolyLog[2,-x],{x,Infinity,2}]

FullSimplify[Assuming[ml>mr && bl>br && br>0,1/(2Pi) Integrate[(br/(bl-br)(ml-mr)-w)(1/(Exp[bl(w)]+1)-1/(Exp[br(w+ml-mr)]+1)),{w,ml,ml+br/(bl-br)(ml-mr)}]],ml>mr && bl>br && br>0]
Assuming[ml>mr && bl>br && br>0,1/(2Pi) Integrate[(ml-mr)(1/(Exp[bl(w-ml)]+1)-1/(Exp[br(w-mr)]+1)),{w,ml,ml+br/(bl-br)(ml-mr)}]]

FullSimplify[-((PolyLog[2,-(E^(br (ml-mr)))])/(br^2))+((-(π^2)+12 bl (ml-mr) Log[1+(E^((bl br (ml-mr))/(bl-br)))]+(-12+((12 (bl^2))/(br^2))) PolyLog[2,-(E^((bl br (ml-mr))/(bl-br)))])/(12 (bl^2))),ml>mr && bl>br && br>0]