title: Griewank function
text: # Griewank function
  
  In mathematics, the Griewank function is often used in testing of optimization. It is defined as follows:
  
      $1+{\frac {1}{4000}}\sum _{i=1}^{n}x_{i}^{2}-\prod _{i=1}^{n}\cos \left({\frac {x_{i}}{\sqrt {i}}}\right)$
  
  The following paragraphs display the special cases of first, second and third order Griewank function, and their plots.
  
  ## First-order Griewank function
  
      $g:=1+(1/4000)\cdot x_{1}^{2}-\cos(x_{1})$
  
  The first order Griewank function has multiple maxima and minima.
  
  Let the derivative of Griewank function be zero：
  
      ${\frac {1}{2000}}\cdot x_{1}+\sin(x_{1})=0$
  
  Find its roots in the interval [−100..100] by means of numerical method,
  
  In the interval [−10000,10000], the Griewank function has 6365 critical points.
  
  ## Second-order Griewank function
  
      $1+{\frac {1}{4000}}x_{1}^{2}+{\frac {1}{4000}}x_{2}^{2}-\cos(x_{1})\cos \left({\frac {1}{2}}x_{2}{\sqrt {2}}\right)$
  
  ## Third order Griewank function
  
      $\left\{1+{\frac {1}{4000}}\,x_{1}^{2}+{\frac {1}{4000}}\,x_{2}^{2}+{\frac {1}{4000}}\,{x_{3}}^{2}-\cos(x_{1})\cos \left({\frac {1}{2}}x_{2}{\sqrt {2}}\right)\cos \left({\frac {1}{3}}x_{3}{\sqrt {3}}\right)\right\}$
  