Question: Something weird with dsolve and Heaviside functions

For the following program using dsolve to solved a differential equation with a sum of exponential inputs, the time required has a huge dependence on subtle difference in paramters.

For example, if Cl := 0.32, calculation time is 1.4 sec.    If Cl := 0.33,  calculation time is 39 sec.

Also, calculation time seems to have huge dependence  on whether or not I truncate M

Can someone please explain what is going on?

restart;
st := time();
N := 4;

T := 5.0/60;
M := 6905;
dose := t -> M*sum(Heaviside(t - 24*k/N)*exp((-t + 24*k/N)/T), k = 0 .. 2*N - 1);
Cl := 0.32;
deq := diff(C(t), t) = dose(t) - Cl*C(t);
sol := t -> rhs(dsolve({deq, C(0) = 0}));
p := plot(sol(t), t = 0 .. 48);
time() - st;
                             1.360
 

Please Wait...