# Different results using FindArgMax and ArgMax

I want to find the maximum of $$|g(\kappa)|$$ defined as follows,

For some $$A>0$$, $$\alpha\in (0,\infty)$$, and $$\kappa \in [-\kappa^{*},\kappa^{*}]\subset [-\pi,\pi]$$, define $$g(\kappa )$$ \begin{align} g(\kappa ) &= -\sqrt[]{\Big | \lambda - 4A^{2}\zeta(1+\alpha) -2(1+A^{2})\sum\limits_{m\in\mathbb{Z}_{>0}}\frac{\cos(\kappa m)}{m^{1+\alpha}} \Big |\Big ( \lambda - 2(1+A^{2})\sum\limits_{m\in\mathbb{Z}_{>0}}\frac{\cos(\kappa m)}{m^{1+\alpha}}\Big )}, \end{align} where $$\lambda = 2(1+A^{2})\zeta(1+a)$$

With values $$A = 1$$ and $$\alpha=3$$, the following code tells me that the maximum value is achieved with $$k = 3.12685$$.

Clear["Global*"]

f[k_, \[Alpha]_] := Sum[Cos[k*m]/m^(1 + \[Alpha]), {m, 1, Infinity}]
kmax = With[{A = 1, \[Alpha] = 3},
N[ArgMax[{(Abs[2(1+A^2)Zeta[1+\[Alpha]]-4A^2 Zeta[1+\[Alpha]]-2(1+A^2)f[k,\[Alpha]]])(2(1+A^2)Zeta[1+\[Alpha]] - 2(1+A^2)f[k,\[Alpha]]), 0 <= k <= Pi}, k]]]

However,

f[k_?NumericQ, \[Alpha]_?NumericQ] :=
Assuming[0 < k < Pi,
Simplify[Sum[(1 - Cos[k*m])/m^(1 + \[Alpha]), {m, 1, Infinity}]]]
data = Table[{\[Alpha],
First@FindArgMax[{(Abs[2(1+A^2)Zeta[1+\[Alpha]]-4A^2 Zeta[1+\[Alpha]]-2(1+A^2)f[k,\[Alpha]]])(2(1+A^2)Zeta[1+\[Alpha]] - 2(1+A^2)f[k,\[Alpha]]) /.
A -> 1, 0 < k <= Pi}, {k, 1}]}, {\[Alpha], 1, 9}]
ListLinePlot[data, Mesh -> All, Frame -> True,
MeshStyle -> Red,
PlotStyle -> Blue, GridLines -> Automatic,
GridLinesStyle -> LightGray,FrameLabel -> {\[Alpha], "kmax"}]

tells me that for $$\alpha = 3$$, the corresponding "k max" would be $$0.95$$.

Why are these codes not coinciding in their output?

• "ArgMax finds the global maximum of f subject to the constraints given"; whereas, FindArgMax "gives the position Subscript[x, max] of a local maximum of f." If the position of the local max given by FindArgMax is not the same as the position of a global max, provide a starting point to FindArgMax that starts the search near the position of a global max, Commented Mar 18 at 21:55

\$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global*"]

f[k_, α_] := Sum[Cos[k*m]/m^(1 + α), {m, 1, Infinity}]

With[{A = 1, α = 3},
Plot[(Abs[
2 (1 + A^2) Zeta[1 + α] - 4 A^2  Zeta[1 + α] -
2 (1 + A^2) f[k, α]]) (2 (1 + A^2) Zeta[1 + α] -
2 (1 + A^2) f[k, α]),
{k, 0, Pi}]]

kmax = With[{A = 1, α = 3},
N[ArgMax[{(Abs[
2 (1 + A^2) Zeta[1 + α] - 4 A^2  Zeta[1 + α] -
2 (1 + A^2) f[k, α]]) (2 (1 + A^2) Zeta[1 + α] -
2 (1 + A^2) f[k, α]), 0 <= k <= Pi}, k]]] // Quiet

(* 3.14159 *)

kmax = With[{A = 1, α = 3},
FindArgMax[{(Abs[
2 (1 + A^2) Zeta[1 + α] - 4 A^2  Zeta[1 + α] -
2 (1 + A^2) f[k, α]]) (2 (1 + A^2) Zeta[1 + α] -
2 (1 + A^2) f[k, α]), 0 <= k <= Pi}, k]][[1]]

(* 3.1415 *)

In this case, the default starting point for FindArgMax located the global max. However, a different starting point can return a local max.

kmax = With[{A = 1, α = 3},
FindArgMax[{(Abs[
2 (1 + A^2) Zeta[1 + α] - 4 A^2  Zeta[1 + α] -
2 (1 + A^2) f[k, α]]) (2 (1 + A^2) Zeta[1 + α] -
2 (1 + A^2) f[k, α]), 0 <= k <= Pi}, {k, 1}]][[1]]

(* 0.956882 *)
• In the syntax, where do you specify a starting point? Commented Mar 18 at 22:07
• As shown in the documentation, "FindArgMax[f, {x, Subscript[x, 0]}] gives the position Subscript[x, max] of a local maximum of f, found by a search starting from the point x = Subscript[x, 0]. " Commented Mar 18 at 22:09