title: optimize.root() does not find solution to a smooth function
body: <p>I hope that my question can be answered without having runnable code, as its too complex to create a small but running version. The following code is part of my project:</p>
  
  <pre><code>x0 = [0.5, 0.5]
  solution = optimize.root(solveMe, x0, args=(Param, Result, False), method='broyden1')
  if solution.status != 1:
      Result.__dict__
      two.plot_some_function(solveMe, np.arange(0.1, 1.5, 0.1), np.arange(0.1, 1.5, 0.1), Param, Result, False)
      raise Exception ('did not converge')
  </code></pre>
  
  <p><code>solveMe</code> is a function that returns a vector of two residuals, <code>F(x0)</code>. Whenever <code>root()</code> does not converge, I create a grid between <code>0.1</code> and <code>1.5</code> for both variables and just plot the output of <code>F(x0)</code> for any <code>xo</code> on that two-dimensional grid. I also check whether there are grid points such that <em>both</em> residuals are close to zero. The code follows:</p>
  
  <pre><code># for debuggign
  def plot_some_function(func, x, y, *args):
  
      from matplotlib import cm
      import matplotlib.pyplot as plt
      from mpl_toolkits.mplot3d import Axes3D
  
      X, Y = np.meshgrid(x, y)
      Z0 = np.empty(X.shape)
      Z1 = np.empty(X.shape)
  
      for idx in np.ndindex(X.shape):
          x, y = X[idx], Y[idx]
          Z0[idx], Z1[idx] = func([x,y], *args)
          if (abs(Z0[idx]) &lt; 0.1) &amp; (abs(Z1[idx]) &lt; 0.1):
              print idx
  
      for Z in [Z0, Z1]:
          fig, ax = plt.subplots()
          p = ax.pcolor(X, Y, Z, cmap=cm.RdBu, vmin=abs(Z).min(), vmax=abs(Z).max())
          cb = fig.colorbar(p, ax=ax)
      plt.show()
  </code></pre>
  
  <p>I ran my main code. I got an exception, the solution does not converge with a set of parameters. Following are the plots (which show that the function is actually quite smooth). </p>
  
  <p><img src="https://i.stack.imgur.com/9kDzh.png" alt="residual: first equation in F">
  <img src="https://i.stack.imgur.com/9j5b3.png" alt="residual: second equation in F"></p>
  
  <p>The idx output was</p>
  
  <pre><code>(1, 0)
  (2, 1)
  </code></pre>
  
  <p>which corresponds to <code>(0.2, 0.1)</code> and <code>(0.3, 0.2)</code>. </p>
  
  <p>But why does <code>root()</code> not converge then? Its output follows</p>
  
  <pre><code>  status: 2
   success: False
       fun: array([ 0.01725503,  0.25234002])
         x: array([ 0.36981866,  0.4440247 ])
   message: 'The maximum number of iterations allowed has been reached.'
       nit: 300
  </code></pre>
  
  <p>An additional fine-tuning in the grid for the matrices actually gives me the coordinates for the following:</p>
  
  <pre><code>solveMe([0.165, 0.258], Param, Result, False)
  Out[6]: array([ 0.00012388,  0.00105457])
  </code></pre>
  
  <p>Which is much smaller than what the solver found.</p>