0
$\begingroup$

I am trying to maximize two functions. For the first one, the code runs correctly and returns the desired answer:

Maximize[{
    ax (Log[a] - Log[ax + cy]) + 
    bx (Log[b] - Log[bx + dy]) + 
    cy (Log[c] - Log[ax + cy]) + 
    dy (Log[d] - Log[bx + dy]),
    x >= 0, y >= 0, x + y == 1
  }, 
  {x, y}]
{ax Log[a] + bx Log[b] + cy Log[c] - ax Log[ax + cy] - cy Log[ax + cy] + 
      dy Log[d] - bx Log[bx + dy] - dy Log[bx + dy], 
 {x -> 1/2, y -> 1/2}}

But for the second one,

Maximize[{
    (1/2) (x Log[x] + y Log[y] + u Log[u] + v Log[v]) - 
    (1/2) (x + u) Log[(1/2) (x + u)] - 
    (1/2) (y + v) Log[(1/2) (y + v)], 
    x >= 0, y >= 0, u >= 0, v >= 0, 
    x + y == 1, u + v == 1
  }, 
  {x, y, u, v}]

I just get the same thing I wrote as an input.

What am I doing wrong? How should I fix it?

$\endgroup$
1
$\begingroup$

Did you check the answer with NMaximize command?

NMaximize[{(1/2) (x Log[x] + y Log[y] + u Log[u] + v Log[v]) 
            - (1/2) (x + u) Log[(1/2) (x + u)] - (1/2) (y + v) Log[(1/2) (y + v)], 
           x >= 0, y >= 0, u >= 0, v >= 0, x + y == 1, u + v == 1}, {x, y, u, v}]
NMaximize::nnum: "The function value Indeterminate is not a number at 
 {u,v,x,y} = {2.89263*10^-8,1.,1.,0.} >>

{0.693147, {u -> 5.00551*10^-9, v -> 1., x -> 1., y -> 3.92799*10^-8}}
$\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.