title: Curve fitting in Python subject to the constraint of having positive derivative
body: <p>I am trying to fit a quadratic polynomial to data, subject to the constraint that the polynomial should have positive derivative for <code>x&gt;0</code>.</p>
  
  <p>Without the constraint, the following works:</p>
  
  <pre><code>def poly(x, a, b, c):
      return a + b*x + c*x**2
  
  popt, pcov = curve_fit(poly, x, y)
  </code></pre>
  
  <p>where <code>x,y</code> contain the data to be fit to.</p>
  
  <p>How do I add in the constraint that <code>b+cx</code> should be positive when <code>x&gt;0</code>?</p>