# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

## Initial Value DDE of Neutral Type

This example shows how to use `ddensd` to solve the initial value DDE presented by Jackiewicz [1] for 0 ≤ t ≤ 0.1.

Click `ddex5.m` or type `edit ddex5.m` in a command window to view the code for this example in an editor.

The equation is

y '(t) = 2cos(2t) y(t/2)2cos(t) + log(y '(t/2)) – log(2cos(t)) – sin(t).

This is an initial value DDE because the delays are zero at t0. The initial conditions are:

y(0) = 1

y '(0) = s,

where s is the solution of:

2 + log(s) – log(2) = 0.

This equation is satisfied by s1 = 2 and s2 = 0.4063757399599599.

1. Create a new program file in the editor. This file will contain a main function and one local function.

2. Define the DDE as a local function.

```function yp = ddefun(t,y,ydel,ypdel) yp=2*cos(2*t)*ydel^(2*cos(t))+log(ypdel)-log(2*cos(t))-sin(t); end```
3. Define the solution delay and derivative delay. Add this line to the main function.

`delay = @(t,y) t/2; `

You can use one anonymous function to handle both delays since they are the same in the equation.

4. Define the initial conditions, `y0` and `s1`, and the interval of integration, `tspan`. Add this code to the main function.

```y0 = 1; s1 = 2; tspan = [0 0.1]; ```
5. Solve the DDE for 0 ≤ t ≤ 0.1, with initial conditions y(0) = 1, and y '(0) = 2. Add this code to the main function.

`sol1 = ddensd(@ddefun,delay,delay,{y0,s1},tspan);`
6. Solve the equation again, this time using y '(0) = 0.4063757399599599. Add this code to the main function.

```s2 = 0.4063757399599599; sol2 = ddensd(@ddefun,delay,delay,{y0,s2},tspan);```
7. Plot the results. Add this code to the main function.

```figure plot(sol1.x,sol1.y,sol2.x,sol2.y); legend('y''(0) = 2','y''(0) = .40638','Location','NorthWest'); xlabel('time t'); ylabel('solution y'); title('Two solutions of Jackiewicz''s initial-value NDDE');```
8. Run your program to calculate and plot the solutions for each value of s.

## References

[1] Jackiewicz, Z. "One step Methods of any Order for Neutral Functional Differential Equations." SIAM J. Numer. Anal. Vol. 21, Number 3. 1984. pp. 486–511.