Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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}}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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