FindMaximum
[f, {x, $x_0$}]x=$x_0$
. FindMaximum
by default uses Newton's method, so the function of interest should have a first derivative.
FindMaximum[-(x-3)^2+2., {x, 1}]
FindMaximum[-10*^-30 *(x-3)^2+2., {x, 1}]
FindMaximum[Sin[x], {x, 1}]
phi[x_?NumberQ]:=NIntegrate[u, {u, 0., x}, Method->"Internal"];
Quiet[FindMaximum[-phi[x] + x, {x, 1.2}, Method->"Newton"]]
Clear[phi];
For a not so well behaving function, the result can be less accurate:
FindMaximum[-Exp[-1/x^2]+1., {x,1.2}, MaxIterations->10]