title: Scipy odeint Non-negative solution
body: <p>Apparently, <a href="https://stackoverflow.com/questions/6977107/solving-a-delay-differential-equation-dde-system-constrained-to-give-nonnegati">getting a non-negative solution from an ODE solver is non-trivial</a>. In Matlab, there is the <a href="http://www.mathworks.com/help/matlab/ref/odeset.html" rel="nofollow noreferrer">NonNegative option</a> for certain solvers to get a non-negative solution. Is there a similar option in scipy?</p>
  
  <p>If not, what is the "best" way of imposing a non-negativity constraint? At the moment, I have something like the following:</p>
  
  <pre><code>def f(x, t, params):
       ... ... ...
       ... ... ...
       x_dot[(x &lt;= 0) * (x_dot &lt;= 0)] = 0.0
       return x_dot
  ... ... ...
  x = odeint(f, x0, t, args=params)
  </code></pre>
  
  <p>However, this leads to numerical instabilities. I've needed to set mxstep to 1e8 and hmin=1e-15.</p>