**Introduction**

Delayed differential equations (DDEs) can be implemented in a block EQUATION: of the section [LONGITUDINAL]. For that, the function delay is proposed. This function allows to delay a dynamical variable by a constant time. One can also build a model with several delays. Delays in the absorption after drug administration must be implemented using the keyword Tlag in the administration macros.

**Example**

We consider in this example a first order delay differential equation on x defined by:

This DDE is typically an accumulation process with a delayed linear elimination treatment. This model is implemented in the file `mlxt_dde.txt`

:

DESCRIPTION: Model description with a delay [LONGITUDINAL] input = {V, ka, k, tau} EQUATION: t0 = 0 x_0 = V ddt_x = ka*x-k*delay(x,tau)

The result of the simulation is performed by `Mlxplore`

using (V=10, k=0.5, k=.25, tau=2) and is proposed on the following figure. The interesting part in this example is that the delay has an important impact on the stability of the system. This kind of systems can thus be explored by `Mlxplore`

.

**Rules **

- The delay function can delay a “pure” component in a dynamical equation. There are three main things to point out and we will discuss the three of them:
- By pure, we mean that the function can not take state calculations into account. In the previous example, if we had used delay(k*x,tau) instead of k*delay(x,tau), this would have generated an error.
- By component, we mean that the delay function can only delay variable with a dynamic behavior (defined by a derivative equation). In the previous example,using the delay function with anything else than x would lead to an error.
- By dynamical equation, we mean that the delay function should be called directly in a ddt_ equation. For example, if we have in addition a DDE of the form , one could be tempted to implement it in
`Mlxtran`

under the following incorrect form:z = delay(x,1) ddt_y = z-y

It should be defined directly as

ddt_y = delay(x,1)-y

The first implementation would lead to an error.

- The delay must remain constant over the time.
- It is good practice to define the initial conditions of the DDE system (t0 and initial values for the variables). If the initial condition is not defined, then it is set to the default value 0. Notice that you can have varying initial conditions. Note also that an initialization can be performed if the values can be analytically computed. For example, we can define , and it would be translated in
`Mlxtran`

under the formx_0 = V*(1+t)