# Maximize vs FindMaximum

This can be thought of as follow-up to this question. The question is, simply, can anyone explain why both Maximize[] and FindMaximum[] (and their minimalist counterparts) exist. The documentation seems to draw no meaningful distinction between the two...

FindMaximum searches for a local maximum in f, starting from an automatically selected point.

max1 = FindMaximum[x Cos[x], x]

(*  {0.561096, {x -> 0.860334}}  *)


Specifying different starting values gives different results

max2 = FindMaximum[x Cos[x], {x, #}] & /@ {1, 6, 10}

(*  {{0.561096, {x -> 0.860334}}, {6.361, {x -> 6.4373}}, {12.6059, {x ->
12.6453}}}  *)


Maximize searches for a global maximum. If f and constraints are linear or polynomial, Maximize will always find a global maximum.

Maximize[{x Cos[x], 0 < x < 15}, x] // N

(*  {12.6059, {x -> 12.6453}}  *)


To find all peaks in the interval

sol3 = ({x Cos[x], {"x" -> x}} /.
NSolve[{
D[x Cos[x], x] == 0,
D[x Cos[x], {x, 2}] < 0,
0 < x < 15}, x]) /. "x" :> x

(*  {{0.561096, {x -> 0.860334}}, {6.361, {x -> 6.4373}}, {12.6059, {x ->
12.6453}}}  *)

• Thanks! I did not realize that FindMaximum[] did not even try to look for a global maximum... Commented Apr 2, 2017 at 23:34
• To add, NMaximize[] tries to find a global maximum. Commented Apr 3, 2017 at 0:38