2
$\begingroup$

I am trying to find the maximum of the following expression:

enter image description here

I can not figure out why Mathematica returns me the original expression.

I am new to Mathematica and tired to search around but could not find an answer to address this question.

Code corresponding to the image posted above:

FindMaximum[
  {(p (4 t^2 V (-1 + α) α - 4 p^3 β2 + 
         p^2 (β1^2 + β2 + 4 V β2 - 4 t (α - β2 + α β2)) - 
         p t (4 t α^2 + β1^2 + 4 V β2 - α (1 + 4 t + β1^2 + 4 V (1 + β2))))) /
     (4 t (p + t (-1 + α)) (t α + p β2)), 
   0 <= α <= 1}, 
  {α, 0}] 
$\endgroup$

closed as off-topic by b3m2a1, Roman, MarcoB, user42582, Alex Trounev Jun 3 at 16:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – b3m2a1, Roman, MarcoB, user42582, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Please always post copyable code, not just a screenshot. We can't run your code. $\endgroup$ – Szabolcs May 29 at 20:43
  • 1
    $\begingroup$ Note that FindMaximum uses numerical methods, but you gave it an expression with symbolic parameters. It can't possibly work. I don't immediately see why it didn't show an error though. $\endgroup$ – Szabolcs May 29 at 20:44
  • $\begingroup$ added the code. If I wish to contain the symbolic parameters and find a maximum of this function, but based on the first order and second order derivative, it is not immediately obvious whether by setting FOC = 0 will return a maximum value. In this case, what should I do then? $\endgroup$ – lll May 29 at 20:52
3
$\begingroup$

there are two candidates for the maximum, just check those:

f[α_] = (p (4 t^2 V (-1 + α) α - 4 p^3 β2 + p^2 (β1^2 + β2 + 4 V β2
  - 4 t (α - β2 + α β2)) - p t (4 t α^2 + β1^2 + 4 V β2
  - α (1 + 4 t + β1^2 + 4 V (1 + β2)))))/(4 t (p + t (-1 + α))(t α
  + p β2));

f'[α] // FullSimplify

1/4 p^2 (-(1/(p + t (-1 + α))^2) - β1^2/(t α + p β2)^2)

sol = Solve[% == 0, α] // FullSimplify

$$ \left\{\left\{\alpha \to -\frac{\sqrt{\beta_1^2 \left(-t^2\right) ((\beta_2-1) p+t)^2}+\beta_1^2 t (p-t)+\beta_2 p t}{\left(\beta_1^2+1\right) t^2}\right\},\left\{\alpha \to \frac{\sqrt{\beta_1^2 \left(-t^2\right) ((\beta_2-1) p+t)^2}-p t \left(\beta_1^2+\beta_2\right)+\beta_1^2 t^2}{\left(\beta_1^2+1\right) t^2}\right\}\right\} $$

There are four candidates for the maximum: $\alpha=0$, $\alpha=1$, and the two solutions above:

A = {0, 1, α /. sol[[1]], α /. sol[[2]]};

For given parameters $\beta_1$, $\beta_2$, $p$, $t$ you need to first check if the last two of these lie in the range $[0,1]$, and then compare the values of the function at these points to see which one is the largest:

FullSimplify[f /@ A]
(* lengthy output of four values of the function *)

If you give example values of the parameters $\beta_1$, $\beta_2$, $p$, $t$, I can show you an example.

$\endgroup$
  • $\begingroup$ thanks, but I am a bit confused here. Is that for solving for maximum within a specified range of a variable (like the function I have above), setting FOC == 0, and check for all the values with FOC == 0, and corner points? Thanks for the clarification! $\endgroup$ – lll May 29 at 22:23
  • $\begingroup$ What does "FOC" stand for? $\endgroup$ – Roman May 30 at 8:47
  • $\begingroup$ first order condition $\endgroup$ – lll May 30 at 13:27
  • $\begingroup$ Yes that sounds like it then. Just give it a try with concrete parameters. $\endgroup$ – Roman May 30 at 13:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.