title: error using L-BFGS-B in scipy
body: <p>I get some puzzling result when using the 'L-BFGS-B' method in scipy.optimize.minimize:</p>
  
  <pre><code>import scipy.optimize as optimize
  import numpy as np
  
  def testFun():
      prec = 1e3
  
      func0 = lambda x: (float(x[0]*prec)/prec+0.5)**2+(float(x[1]*prec)/prec-0.3)**2
      func1 = lambda x: (float(round(x[0]*prec))/prec+0.5)**2+(float(round(x[1]*prec))/prec-0.3)**2
  
      result0 = optimize.minimize(func0, np.array([0,0]), method = 'L-BFGS-B', bounds=((-1,1),(-1,1)))
      print result0
      print 'func0 at [0,0]:',func0([0,0]),'; func0 at [-0.5,0.3]:',func0([-0.5,0.3]),'\n'
  
      result1 = optimize.minimize(func1, np.array([0,0]), method = 'L-BFGS-B', bounds=((-1,1),(-1,1)))
      print result1
      print 'func1 at [0,0]:',func1([0,0]),'; func1 at [-0.5,0.3]:',func1([-0.5,0.3])
  
  def main():
      testFun()
  </code></pre>
  
  <p>func0() and func1() are almost identical quadratic functions with only a precision difference of 0.001 for input values. 'L-BFGS-B' method works well for func0. However, by just adding a round() function in func1(), 'L-BFGS-B' stops to search for optimal values after first step and directly use initial value [0,0] as the optimal point.</p>
  
  <p>This is not just restricted to round(). Replace round() in func1() as int() also results in the same error.</p>
  
  <p>Does anyone know the reason for this?</p>
  
  <p>Thanks a lot.</p>