title: Interpreting the amax parameter in scipy's line_search
body: <p>In SciPy 1.0.0, according to <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.line_search.html" rel="nofollow noreferrer">its documentation</a>, <code>scipy.optimize.line_search</code> has an optional parameter <code>amax</code> which determines the "Maximum step size".</p>
  
  <p>As such, I would expect that the first return value, <code>alpha</code>, would always be less than the given <code>amax</code>, but this is not the case, as the following example illustrates:</p>
  
  <pre><code>from scipy.optimize import line_search
  
  def f(x):
      return x[0]**2 + x[1]**2
  
  def df(x):
      return 2*x
  
  x = np.array([4, 5])
  line_search(f, df, x, -df(x), amax=0.001)
  # Returns (0.5, 3, 1, 0.0, 41.0, array([ 0.,  0.]))
  </code></pre>
  
  <p>In this, the value of <code>alpha</code> is 0.5 but the value of <code>amax</code> is 0.001, which is less than 0.5.</p>
  
  <p>Another interpretation might be that <code>amax</code> limits the distance between the output values <code>x_new</code> and <code>x0</code>, but this is also not the case.</p>
  
  <p>Am I misinterpreting the documentation, or is this a bug in SciPy? And, if it is working as intended, what is the correct interpretation of <code>amax</code>, and is there some other way to limit the range of alphas in which to perform the line search?</p>