3
$\begingroup$

I encountered this problem several times but never managed to understand why. For example, I want to get the maximal value of a parametrized function $\log(c)+ b\log(k-c)$ with respect to $c$. I tried the following code:

In[1] := MaxValue[Log[c] + b Log[k - c], c]

But instead of a funtion of $b$ and $k$, the output is

Out[1] := MaxValue[Log[c] + b Log[k - c], c]

Can you explain why this could happen in this case, and more broadly, likely causes of this problem in other cases?

$\endgroup$
1
  • 1
    $\begingroup$ You ask MMA the max of two symbolic expressions. As c, k and b are not know, MMA can not give more info. However, if you want a function, then you have to define one. If you do not know how to do it, then it's time to read the manual. $\endgroup$ – Daniel Huber Nov 7 '20 at 14:01
3
$\begingroup$

I think MaxValue is mainly designed for polynomial functions. Use Reduce with first derivative equal to zero and second less zero.

red = Reduce[
     Log[c] + b Log[k - c] \[Element] Reals && 
     D[Log[c] + b Log[k - c], c] == 0 && 
     D[Log[c] + b Log[k - c], c, c] < 0, c, Reals]

(*   k > 0 && b > 0 && c == k/(1 + b)   *)

Manipulate[
    Plot[Log[c] + b Log[k - c], {c, -2, 5}], {{b, 1}, 0, 7}, {{k, 2}, 0, 8
 }]
$\endgroup$
3
$\begingroup$

To answer the broader question: When a symbolic function returns unevaluated, it simply means that Mathematica could not solve the problem. It does not mean that there is no solution or that it cannot be solved. It just means that Mathematica could not solve it.

In many cases, this has to do with the presence of symbolic parameters, which are assumed to be complex by default, and can make the problem significantly more difficult.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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