title: Scipy curve_fit returns negative variance
body: <p>I'm trying to use curvefit to fit my data to two logarithms.</p>
  
  <pre><code>from scipy.optimize import curve_fit
  
  def func_2log(x, a, b, c, d, e):
      return a*np.log(x + 1 + b) +c*np.log(x + 1 + d) + e
  
  p, cov = curve_fit(func_2log, x, y, p0 = initial_guess, sigma = yerr, maxfev = 100000)
  </code></pre>
  
  <p>However, when I print the covariance matrix, I get:</p>
  
  <p>[[ -2.23883493e+06  -3.92893042e+09  -1.87846128e+01  -4.27371608e+02
      2.46442543e+07]</p>
  
  <p>[ -3.92893042e+09  -6.89487710e+12  -3.29629278e+04  -7.49919180e+05
      4.32481902e+10]</p>
  
  <p>[ -1.87846014e+01  -3.29629077e+04  -1.53314974e-04  -3.43241587e-03
      2.06772574e+02]</p>
  
  <p>[ -4.27371198e+02  -7.49918462e+05  -3.43241462e-03  -7.58284163e-02
      4.70429813e+03]</p>
  
  <p>[  2.46442543e+07   4.32481902e+10   2.06772700e+02   4.70430264e+03
     -2.71274697e+08]]</p>
  
  <p>How is this matrix mathematically possible? How can a parameter be negatively correlated with itself??</p>
  
  <p>Edit: I didn't want to include the data itself because x and y have about 90,000 elements. x goes from 0 to 87244 in steps of 1 and y ranges from 2 to 7.</p>
  
  <p>Thanks for any help in advance.</p>