work around for a problem in dsolve, numeric?
Of course, there are big differences in dsolve and dsolve numeric. But also there is a difference that is subtle. It would be nice if this subtle one were not there. It may be that there is an easy work-around. Of course, the complication that is at the root of the problem may not be subtle at all.
Look at the results of these two situations.
First situation.
> restart;
> h[0]:=t->(1+t)*t^2*cos(t):
> sol1:=dsolve({diff(y(t),t)=-h[0](t-1),y(0)=h[0](0)},y(t)):
> h[1]:=unapply(rhs(sol1),t):
> sol2:=dsolve({diff(y(t),t)=-h[1](t-1),y(1)=h[1](1)},y(t)):
> h[2]:=unapply(rhs(sol2),t):
> plot([[t,h[0](t),t=-1..0],[t,h[1](t),t=0..1],
[t,h[2](t),t=1..2]],color=blue);
Second situation
> restart;
> k[0]:=t->(1+t)*t^2*cos(t):
> sol1:=dsolve({diff(y(t),t)=-k[0](t-1),y(0)=k[0](0)},y(t),
numeric, output=listprocedure):
> k[1]:=subs(sol1,y(t)):
> plot([[t,k[0](t),t=-1..0],[t,k[1](t),t=0..1]],color=blue);
> sol2:=dsolve({diff(y(t),t)=-k[1](t-1),y(1)=k[1](1)},y(t),
numeric, output=listprocedure):
> k[2]:=subs(sol2,y(t)):
> plot([[t,k[0](t),t=-1..0],[t,k[1](t),t=0..1],
[t,k[2](t),t=1..2]],color=blue);
Of course, where I want to make this delay model is where the ode's are not linear and cannot be solved analytically.

Loading Comments & Answers