title: Why isn't `curve_fit` able to estimate the covariance of the parameter if the parameter fits exactly?
body: <p>I don't understand <code>curve_fit</code> isn't able to estimate the covariance of the parameter, thus raising the <code>OptimizeWarning</code> below. The following MCVE explains my problem:</p>
  
  <p><strong>MCVE python snippet</strong></p>
  
  <pre><code>from scipy.optimize import curve_fit
  func = lambda x, a: a * x
  popt, pcov = curve_fit(f = func, xdata = [1], ydata = [1])
  print(popt, pcov)
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>\python-3.4.4\lib\site-packages\scipy\optimize\minpack.py:715:
  OptimizeWarning: Covariance of the parameters could not be estimated
  category=OptimizeWarning)
  
  [ 1.] [[ inf]]
  </code></pre>
  
  <p>For <code>a = 1</code> the function fits <code>xdata</code> and <code>ydata</code> exactly. Why isn't the error/variance <code>0</code>, or something close to <code>0</code>, but <code>inf</code> instead?</p>
  
  <p>There is this quote from the <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html" rel="noreferrer"><code>curve_fit</code> SciPy Reference Guide</a>:</p>
  
  <blockquote>
    <p>If the Jacobian matrix at the solution doesn’t have a full rank, then ‘lm’ method returns a matrix filled with np.inf, on the other hand ‘trf’ and ‘dogbox’ methods use Moore-Penrose pseudoinverse to compute the covariance matrix.</p>
  </blockquote>
  
  <p>So, what's the underlying problem? Why doesn't the Jacobian matrix at the solution have a full rank?</p>