How this calculation works
A delay differential equation requires an entire earlier history, not just one starting value. This page supports a scalar linear equation with one positive constant delay and a constant prehistory. A method-of-steps calculation uses RK4 and interpolated stored states, with time steps aligned to the delay interval.
y′(t)=a y(t)+b y(t−tau), with constant history for t≤0.A worked example
For y′(t)=y(t−1) and history y(t)=1 for t≤0, the derivative equals one throughout the first interval [0,1]. Therefore y(t)=1+t there and y(1)=2. After time one the delayed argument reaches the newly computed trajectory, producing a different polynomial segment.
Good to know
One constant delay and the printed scalar linear family only. Horizon≤30 delay intervals, 4–1,000 steps per delay and at most 10,000 total steps. Interpolated history and derivative breakpoints can reduce order. No arbitrary history expression, multiple delays or exact-error certificate.
Reference: SciML delay differential equation definitions (opens in a new tab) ↗
History is part of the initial condition
Before positive time, this model specifies the same constant history value at every earlier argument. The delayed term can therefore be evaluated during the first interval even though no future trajectory has been computed. Supplying only y(0) without a history would leave those first derivative evaluations undefined for a positive delay.
The supported equation combines a current-state term and one delayed-state term with constant coefficients. This is a real restriction on the model family, not an arbitrary expression parser. Multiple delays, state-dependent delays or a varying historical function require additional interpolation and continuity handling and are not accepted implicitly.
The Polynomial ODE initial value calculator covers the nearby task. A delayed derivative depends on an earlier state/history interval, absent from the ordinary IVP model.
The method of steps respects the delay
The nominal step is the delay divided by an integer resolution, so stored points align with delay boundaries. RK4 evaluates the current dynamics while delayed arguments refer only to the known history or already computed earlier intervals. Linear interpolation fills between stored delayed states rather than rounding each delayed argument to a nearby grid index.
The final step can be shorter than the nominal step so that the returned time equals the requested horizon. The output reports the nominal step and actual time-state pairs. A shortened final interval does not authorize accessing uncomputed future history; the method still relies on a strictly positive delay longer than the step.
Refinement is needed at derivative breaks
Even with constant prehistory, derivatives can change their smoothness at the start and at later delay multiples. Such breaks can reduce the observed convergence order below the smooth-ODE RK4 order. The page therefore recommends a resolution comparison instead of describing every trajectory as fourth-order accurate with no qualification.
The default has an analytic first segment y=1+t, providing a direct check of both history timing and the endpoint value. Later intervals can be compared with piecewise polynomial solutions or an independent delay solver. Overflow, excessive horizon or too many steps raises an explicit limit error rather than a fabricated finite delayed response.
Understand why a history is needed before time zero
The supported equation is y′(t)=a y(t)+b y(t−τ), with constant delay τ>0 and constant history y(t)=h for t≤0. A single initial value would not determine the delayed term over the first interval, because it refers to a whole stretch of earlier times. Here the history control supplies that entire pre-time-zero stretch.
On [0,τ], the delayed term is known from the constant history, so the equation is an ordinary differential equation with known forcing. On [τ,2τ], it uses the solution already computed on [0,τ]. Repeating this construction is the method of steps. The model therefore retains past states rather than replacing y(t−τ) with the current state.
Build the first two delay intervals explicitly
With a=0, b=1, τ=1 and h=1, the first interval satisfies y′=1, giving y(t)=1+t for 0≤t≤1 and y(1)=2. On 1≤t≤2, the delayed value is y(t−1)=t, so integration from one gives y(t)=2+(t²−1)/2=1.5+t²/2. Hence y(2)=3.5.
An ordinary differential substitute y′=y would instead give exp(t), already producing exp(1) rather than 2 at time one. This comparison shows why removing the delay changes the problem. With b=0, however, delay has no influence and the supported equation reduces exactly to y(t)=h exp(at), a useful independent benchmark for the time integrator.
Refine history resolution without claiming fourth-order accuracy
The resolution control sets a nominal step τ/resolution, aligned to the delay interval. RK4 evaluates the current-state evolution, but delayed values between stored nodes use piecewise-linear interpolation. That interpolation and derivative breakpoints can limit overall convergence below the fourth order associated with a smooth ordinary differential equation.
Repeat a calculation with twice the steps per delay and compare the same final time. Agreement is useful evidence of numerical resolution, not a rigorous error bound. If changes remain large, shorten the horizon or use a dedicated DDE solver. The output table may show a sampled subset of computed states; its display spacing is not necessarily the internal integration step.
Interpret jumps in derivatives and growing trajectories
The solution is continuous at time zero, but its derivative from the right is (a+b)h while the constant history has derivative zero from the left. That mismatch can propagate into higher derivatives at multiples of τ. It is a mathematical feature of the chosen history, not necessarily a programming defect.
Delayed feedback can change stability and generate oscillatory behavior even in a scalar linear model. A finite computed trajectory alone does not classify asymptotic stability or prove long-term boundedness. Coefficient units are inverse time, and τ and the final time must use the same units. Multiple delays, nonconstant histories and state-dependent delays require a different specification than the three scalar terms accepted here.
A few questions, answered
Why is history needed before time zero?
The delayed derivative accesses states at earlier times during the first interval.
Is the trajectory guaranteed fourth-order accurate?
No. Interpolated history and derivative discontinuities can reduce the effective convergence order.
Why is a history different from y(0)?
The delayed term needs values throughout the interval before zero. This form supplies a constant value on that whole interval, not just at its endpoint.
Does using RK4 guarantee fourth-order convergence here?
No. Linear history interpolation and derivative breakpoints can reduce the overall order. Use refinement and an appropriate DDE solver for demanding accuracy requirements.