I tried the code, but it was unsuccessful.
Perhaps I should pose the question differently:
This is the problem: the parameters are T1, T2, R, Rthhot, Rthcold, and Z with feasible range >0. The variables are Rth and Rload.
X and Y are functions of Rload and Rth given by the 2 equations:
0=-(T1 - X)/Rthhot + (X - Y)/Rth + S^2*X*(X - Y)/(R + Rload) + (-1)*0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2
0=(Y - T2)/Rthcold - (X - Y)/Rth - S^2*Y*(X - Y)/(R + Rload) + (-1)*0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2;
and S is a function of Rth is given by:
0=S^2*Rth/R - Z;
I am trying to maximize power as a function of Rload and Rth:
Power=S^2*(X - Y)^2*Rload/(R + Rload)^2;
I know how to solve it using either FindMaximum or Langrage multiplier if I assign numerical values to T1, T2, R, Rthhot, Rthcold, and Z. I'd like to know if it's possible to find an analytic solution if I leave T1, T2, R, Rthhot, Rthcold and Z as parameters. Here is an example of my code:
T1 = 310;
T2 = 300;
Rthhot = 0.1;
Rthcold = 6;
R = 6;
Z = 1/305 ;
Solve[{-(T1 - X)/Rthhot + (X - Y)/Rth + S^2*X*(X - Y)/(R + Rload) -
0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2 ==0, (Y - T2)/Rthcold - (X - Y)/Rth - S^2*Y*(X - Y)/(R +
Rload) - 0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2 == 0,
S^2*Rth/R - Z == 0,
Grad[S^2*(X - Y)^2*Rload/(R + Rload)^2, {X, Y, Rload, Rth, S}] ==
lambda1 Grad[-(T1 - X)/Rthhot + (X - Y)/Rth +
S^2*X*(X - Y)/(R + Rload) -
0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2, {X, Y, Rload, Rth, S}] +
lambda2 Grad[(Y - T2)/Rthcold - (X - Y)/Rth -
S^2*Y*(X - Y)/(R + Rload) -
0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2, {X, Y, Rload, Rth, S}] +
lambda3 Grad[S^2*Rth/R - Z, {X, Y, Rload, Rth, S}]}]
And this code works fine. But if I leave T1, T2, R, Rthhot, Rthcold, and Z as parameters it keeps running for a few days without finding a solution.