private void determineGlobalExtremumType(){
  final double f=function(alphaExtremum);
  double[] alpha_1=new double[alphaExtremum.length];
  double[] alpha_2=new double[alphaExtremum.length];
  for (int i=0; i < alphaExtremum.length; i++) {
    alpha_1[i]=Math.random() * Math.PI;
    alpha_2[i]=Math.random() * Math.PI;
  }
  double f1=function(alpha_1);
  double f2=function(alpha_2);
  if (f1 < f && f2 < f) {
    extremumType=ExtremumType.MAXIMUM;
  }
 else   if (f1 > f && f2 > f) {
    extremumType=ExtremumType.MINIMUM;
  }
 else   if (Math.abs(f1 - f) < DELTA && Math.abs(f2 - f) < DELTA) {
    extremumType=ExtremumType.CONSTANT;
  }
 else {
    throw new IllegalStateException("Houston, we have a problem:" + "\n" + this + "\nextremum at "+ FormatUtil.format(alphaExtremum)+ "\nf  "+ f+ "\nf1 "+ f1+ "\nf2 "+ f2);
  }
}

private void determineGlobalExtremumType ( ) { final double f = function ( alphaExtremum ) ; double [ ] alpha_1 = new double [ alphaExtremum . length ] ; double [ ] alpha_2 = new double [ alphaExtremum . length ] ; for ( int i = 0 ; i < alphaExtremum . length ; i ++ ) { alpha_1 [ i ] = Math . random ( ) * Math . PI ; alpha_2 [ i ] = Math . random ( ) * Math . PI ; } double f1 = function ( alpha_1 ) ; double f2 = function ( alpha_2 ) ; if ( f1 < f && f2 < f ) { extremumType = ExtremumType . MAXIMUM ; } else if ( f1 > f && f2 > f ) { extremumType = ExtremumType . MINIMUM ; } else if ( Math . abs ( f1 - f ) < DELTA && Math . abs ( f2 - f ) < DELTA ) { extremumType = ExtremumType . CONSTANT ; } else { throw new IllegalStateException ( "Houston, we have a problem:" + "\n" + this + "\nextremum at " + FormatUtil . format ( alphaExtremum ) + "\nf  " + f + "\nf1 " + f1 + "\nf2 " + f2 ) ; } }
determines the type of the global extremum .
