I am trying to investigate some properties of DDEs with time-varying delays. As an approximation, I am trying to evaluate a basic DDE from time -10 to 10 with a specified constant delay, and then using the solution of that DDE from time 0 to 10 as the initial condition for a second DDE with a new constant delay over time 0 to 20, with the goal of repeating the process many times.
However, I cannot get NDSolve to accept the solution from the previous DDE as the initial condition of the new DDE. Here is what the code looks like.
Delay[x_] := -Exp[-x] + Pi/2; DDEstep[z_, y_] := NDSolve[{x'[t] == - x[t - Delay[10 z - 10]], x[t /; t <= 10 z - 10] == y}, x, {t, 10 z - 20, 10 z}]; step1 = DDEstep[1, 1]; step2 = DDEstep[2, x[t] /. step1[[1]]] When I try to run it, I get the following error: "NDSolve: Initial history needs to be specified for all variables for delay-differential equations." NDSolve seems to find "x[t] /. step1[[1]]" to be an unacceptable form for the initial condition. For an ODE, it would be as easy as using Evaluate on the specific time of the initial condition (as has been described in other questions on the site) but since this is a DDE, I need my initial condition over a time interval. I know that user defined functions of t work when plugged in as initial conditions, so I would like someone to explain why "x[t] /. step1[[1]]" is not the same as a function of t.


10 z - 10to match the time in the initial history, answers are computed. Do the solutions see right? $\endgroup${t, a, b}inNDSolve[]is independent of the DE. It does not even have to include initial or boundary conditions. I think there must be some internal test for the initial history that makes a mistake when it is given by anInterpolatingFunction. See the second method in my answer for a way to trickNDSolveinto accepting it. If the solution seems wrong, let me know. $\endgroup$