The code below solve the ODE $$y''+3y'+2y = -\frac{10}{h}(u(t-1)-u(t-(1+h))).$$ This represents a mass-spring system that has a force of $-10/h$ turned on at $t=1$ and off at $t=1+h$. The goal is to see what happens as $h\to 0$. This means we increase the force at the same rate we decrease the interval of time over which we apply the force.

<sagecell> t = var('t') y = function('y', t) h=1; ode = diff(y,t,2)+3*diff(y,t)+2*y == -10/h*(unit_step(t-1)-unit_step(t-(1+h)) )

sol=desolve(ode, y,[0,0,0]); p=plot(sol,(t,0,10),color='red')

h=1/2; ode = diff(y,t,2)+3*diff(y,t)+2*y == -10/h*(unit_step(t-1)-unit_step(t-(1+h)) ) sol=desolve(ode, y,[0,0,0]); p+=plot(sol,(t,0,10),color='blue')

h=1/4; ode = diff(y,t,2)+3*diff(y,t)+2*y == -10/h*(unit_step(t-1)-unit_step(t-(1+h)) ) sol=desolve(ode, y,[0,0,0]); p+=plot(sol,(t,0,10),color='green')

h=1/20; ode = diff(y,t,2)+3*diff(y,t)+2*y == -10/h*(unit_step(t-1)-unit_step(t-(1+h)) ) sol=desolve(ode, y,[0,0,0]); p+=plot(sol,(t,0,10),color='black')

show("The red graph is h=1.") show("The blue graph is h=1/2.") show("The green graph is h=1/4.") show("The black graph is h=1/20.") show("What happens as h approaches 0?") show(p)

</sagecell>