How to find maximum (not with numbers,but with parameters) of 2-variables function under constraints?

I have these functions:

f[dA_,dB_] :=(3.2 (0.389 +dA (-2 (0.175 + 0.012 dB) + 0.078 (-1 + dB) +0.012 (-1 + dB)^2) + dA^2 (0.214 - 0.027 dB) - 0.039 (-1 + dA) (-1 + dB)^2 + (-0.027 + 0.175 (-2 + dB)) dB) + (-1 + dA) (-1 + dB) (2.04 (-1 + dA) (-1 + dB) + (-1 + dA dB) Vin))/((-1 + dA) (-1 + dB) (-1 + dA dB) Vin)
g[dA_,dB_] :=-3.2 (0.214/(1 - dA) + (0.187 dA)/(1 - dA)^2) + ((1 - (1.02 (1 - dA))/Vin) Vin)/(1 - dA)
h[dA_,dB_] :=-3.2 (0.214/(1 - dB) + (0.187 dB)/(1 - dB)^2) + (dB (1 - (1.02 (1 - dB))/(dB Vin)) Vin)/(1 - dB)


I would like to find the maximum of f, with parameter Vin. Also, the following constraints must be met:

0<dA<1 && 0<dB<1 && 0<Vin<=625 && g+h=625


I have been trying to use the function FindMaximum, but I think I do something wrong and I don't have any solution.

FindMaximum[{f, 0 < dA < 1 && 0 < dB < 1 && 0 < Vin <= 625 && g + h=625},{dA, dB}]


Could somebody help me understand what is my mistake or suggest another way to solve my problem? I have been also trying to use Partial Differential Equations, but I didn't have results also there.

You need to give numeric values to Vin.

This:

max = Table[{dA, dB} /.
FindMaximum[{f[dA, dB],
0 < dA < 1 && 0 < dB < 1 && g[dA, dB] + h[dA, dB] == 625},
{{dA, 1/2}, {dB, 1/2}}, Method -> "InteriorPoint"][[2]], {Vin, 1, 625}]


or better this:

max = Table[
FindArgMax[{f[dA, dB],
0 < dA < 1 && 0 < dB < 1 && g[dA, dB] + h[dA, dB] == 625},
{{dA, 1/2}, {dB, 1/2}}, Method -> "InteriorPoint"], {Vin, 1, 625}];


shows that the maximum is along the line dA = dB for all Vin:

ListPlot[max, Frame -> True, PlotStyle -> Black, AspectRatio -> 1,
PlotRange -> {{0, 1}, {0, 1}}, FrameLabel -> {"dA", "dB"}]


To verify:

Manipulate[
Plot3D[f[dA, dB] /. Vin -> v0, {dA, 0, 1}, {dB, 0, 1}],
{{v0, 100}, 1, 625, Appearance -> {"Open"}}]


c = max[[100]]


{0.731275, 0.731275}

f @@ c /. Vin -> 100


0.970111

(g @@ c + h @@ c) /. Vin -> 100


625.

f[0.5, 0.5] /. Vin -> 100


0.976091

• Thank you very much for the analytical and quick answer. Indeed, I am expecting dA=dB for all Vin. However, is there a way to have the analytical solution, e.g. dA=function(Vin), dB=function(Vin)? Jan 14, 2018 at 12:10
• Maximize doesn't work for me. Maybe you could use an implementation of the Lagrange multipliers. Jan 14, 2018 at 12:24