Originally Posted by

**free_to_fly** Q: The differential equation y"+y=H(x)-H(x-a), where H is the heaviside step function, and a is a positive parameter, represents a simple harmonic oscillator subject to a constant force for a finite time. Solve the equation in three intervals of x and by applying appropriate matching conditions.

I've used x<0, 0<x<a and x>a as my three time intervals.

I managed to get:

y"+y=0 for x<0

y"+y=1 for 0<x<a

y"+y=0 for x>a.

Boundary conditions that I've come up with so far are y(0)=0 and y'(0)=1 and y'(a)=-1

The solutions so far that I've been able to get are:

y=0 for x<0

y=1-cosx for 0<x<a

but I'm stuck on the last time interval.

For all three intervals I used y=Asinx+Bcosx as my complementary function, and added a particular integral where neccessary, but the answers that I've been given tell me that for x>a, y=cos(x-a)-cosx. I dont see where this comes from, please enlighten me.

Edit: some1 mentioned using Laplace transforms for this but we havent covered that yet, so I'm thinking maybe there's another way to attack the question?