# Mathematica won't maximize my function

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?

-

## 1 Answer

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}}

-