title: Solving a delay differential equation (DDE) system constrained to give nonnegative solutions
body: <p>In MATLAB, <a href="http://www.mathworks.com/help/techdoc/ref/ode45.html" rel="noreferrer"><code>ode45</code></a> has a parameter called <a href="http://www.mathworks.com/help/techdoc/ref/odeset.html#f92-1016858" rel="noreferrer"><code>NonNegative</code></a> which constrains the solutions to be nonnegative. <a href="http://www.sciencedirect.com/science/article/pii/S0096300304009683" rel="noreferrer">They even wrote a paper about how this method works</a> and how it's not something as stupid as just setting y_i to 0 whenever it becomes negative, as that won't generally work.</p>
  
  <p>Now, MATLAB also has <a href="http://www.mathworks.com/help/techdoc/ref/dde23.html" rel="noreferrer"><code>dde23</code></a> for solving delay differential equations, but there is no equivalent <code>NonNegative</code> parameter for this integrator.</p>
  
  <p>Unfortunately, I am tasked with adding a delay to an existing ODE system which is solved using <a href="http://www.mathworks.com/help/techdoc/ref/ode45.html" rel="noreferrer"><code>ode45</code></a> with <a href="http://www.mathworks.com/help/techdoc/ref/odeset.html#f92-1016858" rel="noreferrer"><code>NonNegative</code></a> enabled.</p>
  
  <p>Any ideas how I should proceed?</p>
  
  <p>EDIT:</p>
  
  <p>I'm not sure if this is helpful, but...</p>
  
  <p>The DDE part of my system basically looks like:</p>
  
  <pre><code> dx = 1/(1+y*z) - x;
   dy = (y*z)^2/(1+(y*z)^2) - y;
   dz = X - z;
  </code></pre>
  
  <p>where <code>X</code> (the capital letter variable in the third equation) is the delayed version of <code>x</code>. Then, I'm linking this DDE system to an existing (and larger) ODE system by adding a couple terms to the equations for <code>x</code> and <code>z</code>, and then integrating the combined system all together.</p>