Firstly, this seems like (from ContourPlot) a fairly straightforward maximization problem, why is FindMaximum with Newton's method having problems?
Secondly, how can I get rid of the warnings?
Thirdly, if I can't get rid of these warnings, how can I tell if the warning is meaningful, ie, maximization failed?
For instance, in the code below, FindMaximum with Newton's method gives a warning, whereas the PrincipalAxis method doesn't
o = 1/5 Log[E^(-(h/Sqrt[3]))/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
3/10 Log[E^(h/Sqrt[3])/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/5 Log[E^(-(h/Sqrt[3]) - Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/10 Log[E^(h/Sqrt[3] - Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/10 Log[E^(-Sqrt[3] h + Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/10 Log[E^(Sqrt[3] h + Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))];
(* -1 makes more contours towards maximum *)
contourFunc[n_, p_] := Function[{min, max},
range = max - min;
Table[Exp[p (x - 1)] x range + min, {x, 0, 1, 1/n}]
];
cf = contourFunc[10, -1];
ContourPlot @@ {o, {j, -1, 1}, {h, -1, 1}, Contours -> cf}
FindMaximum @@ {o, {{j, 0}, {h, 0}}, Method -> "Newton"}
FindMaximum @@ {o, {{j, 0}, {h, 0}}, Method -> "PrincipalAxis"}
Note, I thought that maybe gradient being 0 in direction of one of the components was the problem, but if I perturb the initial point I still get the same warning, here's an example
o = 1/5 Log[E^(-(h/Sqrt[3]))/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/5 Log[E^(h/Sqrt[3])/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/10 Log[E^(-(h/Sqrt[3]) - Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
3/10 Log[E^(h/Sqrt[3] - Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/10 Log[E^(-Sqrt[3] h + Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))] +
1/10 Log[E^(Sqrt[3] h + Sqrt[2] j)/(
2 E^(-(h/Sqrt[3])) + 2 E^(h/Sqrt[3]) +
E^(-(h/Sqrt[3]) - Sqrt[2] j) + E^(h/Sqrt[3] - Sqrt[2] j) +
E^(-Sqrt[3] h + Sqrt[2] j) + E^(Sqrt[3] h + Sqrt[2] j))];
ContourPlot @@ {o, {j, -1, 1}, {h, -1, 1}}
FindMaximum @@ {o, {{j, -0.008983550852535105`}, {h,
0.06931364191023386`}}, Method -> "Newton"}