# How to | Solve Delay Differential Equations

You can use the standard differential equation solving function, NDSolve, to numerically solve delay differential equations with constant delays. It returns an interpolation function that can then be easily used with other functions.

Take the first-order delay differential equation with delay 1 and initial history function . Use NDSolve to solve it and store the solution in . The first argument to NDSolve is the delay differential equation, the second argument is the variable you want to solve for, and the third is the range of the variable:

Out[1]= | |

Plot the solution and its first derivative . To see these in different colors, wrap Evaluate around them. You will also need to load the Plot Legends Package if you want to add a legend to the plot:

Out[3]= | |

Use Manipulate to let you change the initial function:

Solve a first-order delay differential equation with two constant delays, and 1, and the initial history function :

Out[5]= | |

Plot the solution and its first derivative . To see these in different colors, wrap Evaluate around them:

Out[6]= | |

Solve a second-order delay differential equation with constant delay 1 and the initial history function :

Out[7]= | |

Plot the solution and its first two derivatives and . To see these in different colors, wrap Evaluate around them:

Out[8]= | |

For an explanation of the terms associated with delay differential equations, see "Delay Differential Equations".