# Can Mathematica compute the maximum as a function of parameters?

I have the following function: $$\frac{s}{e^2}(e - s)^\alpha$$

Where $$e \in (0, 1)$$ and $$s \in (0, e)$$. I want to maximize this function with respect to $$e$$ and $$s$$. Obviously the maximum value will depend on $$\alpha$$ and that is precisely what I want: the maximum value as a function of $$\alpha$$. Is there a way to compute this in Mathematica?

I have been trying to use the following code:

f[e_, s_, a_] := (s/e^2 ) (e - s)^a
Maximize[{f[e, s, a], 0 < e < 1, 0 < s < e}, {e, s}]


But this only works if I specify a value for $$\alpha$$. It does not give me what I want.

Now I am aware that the maximum value need not be defined everywhere. But that is one of the things that I want to know: for what values of $$\alpha$$ is the maximum defined. Moreover, I know that the maximum is defined when $$\alpha \in [1, 2]$$ but the above code does not work even when I impose that restriction.

So my question is can Mathematica do what I want it to do? If yes, how can I make it work? Any help will be greatly appreciated.

Need to be careful with possible zero denominators and real, non-integer powers.

Reduce[
D[(s/e^2)(e-s)^a,e]==0&&D[(s/e^2)(e-s)^a,{e,2}]<0&&
D[(s/e^2)(e-s)^a,s]==0&&D[(s/e^2)(e-s)^a,{s,2}]<0&&
Element[e|s|a,Reals],{e,s,a}]


returns

Element[(e-s)^(-1)|e-s,Reals]&&Element[e|s,Reals]&&e!=0&&s==e/2&&a==1


and so

(s/e^2)(e-s)^a/.{a->1,s->e/2}


returns

1/4


Then you can look at

Show[
Plot3D[(s/e^2)(e-s)^1,{s,0,1},{e,0,1},PlotRange->{0,1/2}],
Graphics3D[Line[{{0,0,1/4},{1/2,1,1/4}}]]
]


Put your mouse cursor inside that plot and then press and hold the left mouse button while you drag the cursor around. That will let you reorient the plot in various directions so that you can inspect the line drawn on top of your function.

That seems to show that the maximum might not persist down to s==0, e==0, but if you include the Plot option PlotPoints->100 then it appears that the maximum does persist down to s==0, e==0.

Test that VERY carefully before you even think of trusting it

I think this can be done only numerically.

ClearAll[g, a, s, e];
g[a_?NumericQ]:=NMaximize[{(s/e^2)*(e - s)^a, 0 < e < 1, 0 < s < e}, {e, s},Method -> {"DifferentialEvolution", "SearchPoints" -> 100}]
g[1/Pi + 1]


0.203796, {e -> 0.983881, s -> 0.414744}}

Plot[g[a] // First, {a, 1, 2},PlotPoints -> 30]