I have a set of delay differential equations that I solve numerically from 0 < t < T
. y[T]
is then used as the initial condition for z
to start the next round. I would like to keep track of the evolution of y[T]
for different values of ta
. I planned to do this by generating the list ytotal
for different values of ta
using Table
.
x0 = 10^8; a = 10^-8; dv = 2; d = 0.5; T = 4; b = 200;
sol = ParametricNDSolve[{
x'[t] == -d x[t] - a *x[t]*z[t],
y'[t] == a b Exp[-d ta]*x[t - ta]*z[t - ta] - dv y[t],
z'[t] == -dv z[t],
x[t /; t <= 0] == x0, y[t /; t <= 0] == 0,
z[t /; t <= 0] == z0},
{x, y, z}, {t, 0, T}, {z0, ta}, MaxStepSize -> 10^1000,
Method -> {"StiffnessSwitching"}, MaxSteps -> 10^6,
WorkingPrecision -> MachinePrecision];
{z0 = 1; ytotal[ta] = {z0};
For[i = 0, i < 100, i++,
{z0 = Evaluate[y[z0, ta][T] /. sol];
ytotal[ta] = Append[ytotal[ta], z0];
zeq[ta] = Last[ytotal[ta]]}]}
My current approach is not working. I thought it might be because of an issue arising from using ParametricNDSolve
to vary the delay ta
. Also, I am using a For
loop which I know is advised against in Mathematica but I couldn't figure out how to iterate sol
without one.
t == T
for a giventa
, then changeta
and do it again? $\endgroup$ta
for all 100 iterates. The goal is to generate lists ofy[T]
for different values ofta
over 100 iterates. $\endgroup$t == 0
initial conditions loses the history between iterates then. Do you even need to stop & restartNDSolve
? $\endgroup$y[0] == 0
andz[0] == z0
. (z0 = y[T]
) $\endgroup$z0
becomesy[T]
, should it also inherity[t]
's history? $\endgroup$