title: polyfit refining: setting polynomial to be always possitive
body: <p>I am trying to fit a polynomial to my data, e.g.</p>
  
  <pre><code>import scipy as sp
  
  x = [1,6,9,17,23,28]
  
  y = [6.1, 7.52324, 5.71, 5.86105, 6.3, 5.2]
  </code></pre>
  
  <p>and say I know the degree of polynomial (e.g.: 3), then I just use scipy.polyfit method to get the polynomial of a given degree:</p>
  
  <p>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p>
  
  <pre><code>fittedModelFunction = sp.polyfit(x, y, 3)
  
  func = sp.poly1d(fittedModelFunction) 
  </code></pre>
  
  <p>++++++++++++++++++++++++++++++
  QUESTIONS: ++++++++++++++++++++++++++++++</p>
  
  <p>1) How can I tell in addition that the resulting function func must be always positive (i.e. f(x) >= 0 for any x)? </p>
  
  <p>2) How can I further define a constraint (e.g. number of (local) min and max points, etc.) in order to get a better fitting?</p>
  
  <p>Is there smth like this:
  <a href="http://mail.scipy.org/pipermail/scipy-user/2007-July/013138.html" rel="nofollow">http://mail.scipy.org/pipermail/scipy-user/2007-July/013138.html</a>
  but more accurate?</p>