title: Infinite value in covariance in python
body: <p>I have the following code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from scipy.optimize import curve_fit
  
  y = np.array([25.885,26.139,27.404,30.230]) 
  y_err = np.array([1.851,0.979,2.049,6.729]) 
  x = np.array([0,1,2,3]) 
  
  def func(X, a, b):
      x,y,weight=X
      return (a * (x+0.5)/4.186 + b-y)**2/weight
  
  popt, pcov = curve_fit(func, (x,y,y_err), 0)
  print(popt)
  print(pcov)
  </code></pre>
  
  <p>It's just a simple fitting routing y vs x, but I rewrite it in such a way as to be able to try different definitions for the loss on the fit, so I basically want to minimize the function I have and hence the output should be as close as possible to zero. I later realized there is a minimize function in python, but leaving that aside, I get this covariance matrix:</p>
  
  <pre><code>[[inf inf]
   [inf inf]]
  </code></pre>
  
  <p>while the actual parameters for a and b look quite resonable: <code>[5.23,24.68]</code></p>
  
  <p>What is going on? Thank you!</p>