# Solve delay differential equations manually. Why does this return horizon line?

From Sample,This works correctly.

sol = NDSolveValue[{x''[t] + x[t - 1] == 0, x[t /; t <= 0] == t^2}, x, {t, -1, 5}];

Plot[sol[x], {x, -1, 5}]


Now I want to solve the above via Taylor expansion.

sol = NDSolve[{x''[t] + x[t] - x'[t] == 0, x[t /; t <= 0] == t^2},
x, {t, -1, 5}]


This returns a horizontal line. Obviously not the correct. Why?

Although this works certainly, there is still an error.
How does NDSolve solve the above(top's) delayed equation?

sol = NDSolveValue[{x''[t] + x[t] - x'[t] == 0, x[0] == 0,
x'[0] == -0.1}, x, {t, 0, 5}];
Plot[sol[x],{x,0,5}]

• You have to specify the initial conditions differently: NDSolve[{x''[t] + x[t] - x'[t] == 0, x[0] == 0, x'[0] == 2}, x, {t, 0, 5}] works as expected. – Lukas Lang Jan 8 at 17:52
• Looking at the sample diagram(unfortunately MMA 11.0.1 can't solve the sample) I would expect a negativ initial slope x'[0]! – Ulrich Neumann Jan 8 at 19:37
• @Xminer What error do you mean? On my machine (11.3.0.0), there are no error messages. But I don't get why you set x'[0]==0.1 - to reproduce the result above, you need to set it to x'[0]==2. – Lukas Lang Jan 9 at 8:25
• I mean "error" is "the difference between True Answer(by NDSolve) and My Answer(via Taylor Expansion). I set $x'[0]==-0.1$ because $x'[0]=2$ doesn't reproduce the same result asNDSolve[{x''[t] + x[t - 1] == 0, x[t /; t <= 0] == t^2}, x, {t, -1, 5}] – Xminer Jan 9 at 17:19