private double handleCase1 ( ) { double stpc = SearchInterpolate . cubic2 ( fx , gx , stx , fp , gp , stp ) ; double stpq = SearchInterpolate . quadratic ( fx , gx , stx , fp , stp ) ; // If the cubic step is closer to stx than the quadratic step take that bracket = true ; if ( Math . abs ( stpc - stx ) < Math . abs ( stpq - stx ) ) { return stpc ; } else { // otherwise go with the average of the twp return stpc + ( stpq - stpc ) / 2.0 ; } }
stp has a higher value than stx . The minimum must be between these two values . Pick a point which is close to stx since it has a lower value .