# how do I define a system of delay differential equation using DSolve?

I am trying to define a system of delay differential equations. So far I have:

eqn1 := {P'[t] == -gamma*P[t] + (((theta)^m)/(theta)^m)*Q[t] -
Exp[-gamma*tau]*Q[t - tau] - eps[s]*P[t],
Q'[t] == -beta0*Q[t] - delta*Q[t] + 2*Exp[-gamma*tau], P[0] == 50,
Q[t /; t <= 0] == 10};

DSolve[eqn1, {P[t], Q[t]}, t]
{pans1[t_], qans1[t_]} =
ExpandAll[{P[t], Q[t]} /. Flatten[DSolve[eqn1, {P[t], Q[t]}, t]]]


I am trying to start simple by only putting the delay in the term Q[t-tau] in the equation P'[t]. Once I figure this out, I will have a similar term in the equation for Q'[t]. Before I added the term with the delay, I simply had Q[0==10] for the initial condition. I changed this to Q[t /; t <= 0] == 10 when I put in the delay term but I think this is incorrect or incomplete. I would really appreciate any help with this.

The code as written generates the DSolve::litarg error message. It can be eliminated by using

DSolve[eqn1, {P[t], Q[t]}, {t, 0, 10}]


(The upper limit of integration can be chosen arbitrarily, because this is an initial value problem.) Unfortunately, DSolve returns unevaluated. Adding the option, Assumptions -> tau > 0 does not help.

Nonetheless, progress can be made. Because the ODE for Q is independent of P, it can be solved separately.

tol[t_] = Piecewise[{{DSolveValue[{Q'[t] == -beta0*Q[t] - delta*Q[t] +
2*Exp[-gamma*tau], Q[0] == 10}, Q[t], t] // Simplify, t > 0}}, 10]

(* Piecewise[{{(2*E^(-(beta0*t) - delta*t - gamma*tau)*(-1 + E^((beta0 + delta)*t) +
5*(beta0 + delta)*E^(gamma*tau)))/(beta0 + delta), t > 0}}, 10] *)


Then insert tol in place of Q in the ODE for P.

DSolveValue[{P'[t] == -gamma*P[t] + (((theta)^m)/(theta)^m)*tol[t] -
Exp[-gamma*tau]*tol[t - tau] - eps*P[t], P[0] == 50}, P[t], t,
Assumptions -> tau > 0] // Simplify


After several minutes a solution too long to be reproduced here (with a LeafCount of 1848) results.

This is not the first time that I have seen DSolve fail to solve a set of ODEs but succeed in solving subsets of them that, when combined, give the solution to the original problem.