As $\{p1,p2,p3,p4,p5\}$ represents a probability distribution and $l1,l2$ are the eigenvalues of a stochastic matrix, the function $f$, as defined below, has to be maximized over a certain region.
L[p_List] := (p[[1]] - 0.2)*Log[p[[1]]] + (p[[2]] - 0.2)*
Log[p[[2]]] + (p[[3]] - 0.2)*Log[p[[3]]] + (p[[4]] - 0.2)*
Log[p[[4]]] + (p[[5]] - 0.2)*Log[p[[5]]]
CirculantMatrix[l_List?VectorQ] :=
NestList[RotateRight, RotateRight[l], Length[l] - 1]
CirculantMatrix[l_List?VectorQ, n_Integer] :=
NestList[RotateRight,
RotateRight[Join[Table[0, {n - Length[l]}], l]], n - 1] /;
n >= Length[l]
invFou[l_List] := 0.2*{1 + 2 l[[1]] Cos[2 Pi/5] + 2 l[[2]] Cos[4 Pi/5],
1 + 2 l[[1]] Cos[4 Pi/5] + 2 l[[2]] Cos[2 Pi/5],
1 + 2 l[[1]] Cos[4 Pi/5] + 2 l[[2]] Cos[2 Pi/5],
1 + 2 l[[1]] Cos[2 Pi/5] + 2 l[[2]] Cos[4 Pi/5],
1 + 2 l[[1]] + 2 l[[2]]}
m[l_List] := CirculantMatrix[invFou[l]]
f[p_List, M_List] := L[p.m[M]]/L[p]
We may assume that $l1=0.5$ and $0.37\leq l2 \leq 0.5$. If we try
Maximize[{f[{p1, p2, p3, p4, p5}, {0.5,
l2}], {p1 + p2 + p3 + p4 + p5 == 1 && p1 >= 0 && p2 >= 0 &&
p3 >= 0 && p4 >= 0 && p5 >= 0 && 0.37 <= l2 <= 0.5}}, {p1, p2, p3, p4, p5, l2}]
we get an error:
NMaximize::nrnum: The function value -0.206184-0.256075 I is not a real number at {l2,p1,p2,p3,p4,p5} = {0.446053,-0.0362605,0.263705,0.324533,0.369047,0.0789762}. >>
Why doesn't Mathematica take the maximum over the specified region?
FindMaximum
instead, noting that it finds local maxima, depending on where you start the search. But then,NMaximize
may also yield local maxima. $\endgroup$