Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm 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 I'm I doing wrong? How should I fix it?

share|improve this question

1 Answer 1

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.