1
$\begingroup$

I am trying to find the global maxima of this function

FindMaximum[{Abs[1/2 Sqrt[x^2 + 1/10]
  Exp[-(Cosh[x])/4] - (0.05 + 
  0.0644541/((0.1 + 0.5*x) (3 + Cos[2*\[Pi]*x])) + 
  0.875619*x^2*Sin[1/2*Exp[-2 x]*\[Pi]])], 0 <= x <= 1}, {x, 0.5}]

The result it gives is

{0.044611, {x -> 0.418328}}

Which is only a local maxima not a global maxima. The global maxima in the interval $[0,1]$ occurs around 1. If I start near 1 then only it shows the real global maxima. How can I modify so that it gives global maxima regardless of my initial value.

$\endgroup$
1
  • $\begingroup$ Related Q&A here. $\endgroup$
    – A. Kato
    Commented Sep 5 at 8:08

2 Answers 2

3
$\begingroup$

NMaximize finds global maximum

NMaximize[{Abs[
   1/2 Sqrt[x^2 + 1/10] Exp[-(Cosh[x])/4] - (0.05 + 
      0.0644541/((0.1 + 0.5*x) (3 + Cos[2*\[Pi]*x])) + 
      0.875619*x^2*Sin[1/2*Exp[-2 x]*\[Pi]])], 0 <= x <= 1}, x]
(*{0.0949569, {x -> 1.}}*)
$\endgroup$
2
$\begingroup$

FindMaximum searches local maxima. To see this, first plot your function:

Plot[Abs[
  1/2 Sqrt[x^2 + 1/10] Exp[-(Cosh[x])/4] - (0.05 + 
     0.0644541/((0.1 + 0.5*x) (3 + Cos[2*\[Pi]*x])) + 
     0.875619*x^2*Sin[1/2*Exp[-2 x]*\[Pi]])], {x, 0, 1}]

![enter image description here

If you define a start point of x==0.5, FindMaximum it will climb up backwards to x==0.418. However, if you give start point of x>0.65 it will climb to x==1.

$\endgroup$
1
  • $\begingroup$ This doesn't answer the question, and in fact all the information in this answer (except perhaps the graph) is already present in the question. $\endgroup$ Commented Sep 6 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.