I have the following piecewise function of the variable $e_f$:
$$g(a,b,c,w,F,e_h,e_f)=\begin{cases} \frac{(c-a e_f) (e_f (4e_f w-a)+c)}{8 b e_f^2} & \left(e_f=e_h\land e_f>\frac{c}{a}\right)\lor e_f\geq \frac{c}{a-2 \sqrt{b} \sqrt{F}} \\ 0 & \text{otherwise} \end{cases} $$
where all the parameters $a$, $b$, $c$, $w$, $F$, $e_h$ and $e_f$ are strictly positive ($\gt 0$).
g[a_, b_, c_, w_, F_, eh_, ef_] := Piecewise[{{
((c - a ef) (c + ef (-a + 4 ef w)))/(8 b ef^2),
(ef == eh && ef > c/a) || ef >= c/(a - 2 Sqrt[b] Sqrt[F])
}}, 0]
For given numerical values of $a$, $b$, $c$, $w$, $F$, and for a given $e_h$, I would like to find the value of $e_f$ that maximises $g$. I tried to use the FindMaximum
function, but this seems to miss the point where $e_f=e_h$ where the function may be defined and maximised. For example:
FindMaximum[g[10, 1, 1, 5, 10, 0.24, ef], {ef, 0.2}]
returns {0., {ef -> 0.2}}
and FindMaximum[g[10, 1, 1, 5, 10, 0.24, ef], {ef, 0.3}]
returns {0.698102, {ef -> 0.272076}}
which is the maximum on the continuous part for $e_f\geq \frac{c}{a-2 \sqrt{b} \sqrt{F}}$. So in both cases, the point $e_f=0.24$ where the global maximum $g(10, 1, 1, 5, 10, 0.24, 0.24)=0.753472$ is missed.
Ultimately, I would like to plot the argmax of $g(e_f)$ as a function of $e_h$ for given values of the other parameters. What's the best way to do this?
Maximize[g[10, 1, 1, 5, 10, 0.24, ef], ef ] (*{0.698102, {ef -> 0.272076}}*)
gets a little bit closer to the expected maximum. $\endgroup$Maximize[g[10, 1, 1, 5, 10, 24/100, ef]
performs{217/288, {ef -> 6/25}}
. $\endgroup$