Predicting the behaviour of a spring-mass system under the influence of regular periodic impulses Here is the question:
I have a mass 'm' connected by a spring to a wall. The setup is horizontal. The time period of the mass is 'T0' determined by the spring constant 'k'. The mass obeys a position law x=A*cos(2*pi*t/T0+ phi). Initially we have a certain starting amplitude and phase. this is determined by giving the system some energy at the start and also deciding its position. The system begins harmonic oscillations. After a certain time 'T', an impulse 'J' is delivered to the system in the positive direction. Hereafter, every 'T' secs later the same impulse is delivered to the system. Now depending on the object's velocity at the time of impulse delivery, the impulse either removes or adds energy to the system. Also given initial A and phi the system evolves in a completely deterministic manner. now given initial conditions i want to know the long term behaviour of the system. Does the system keep gaining energy forever? Does it lose energy and stop? Does it display any chaotic or periodic behavior? 
Oh and after each hit i plotted A and phi where A is the new amplitude of motion and phi is the phase constant in the new equation of motion x=A*cos(2*pi*t/T0+phi)
Really sorry if i framed the question in a bad manner. Thanks for any replies!!
 A: The system is linear, so the superposition principle holds. This means that in order to find the solution, you need to sum the unperturbed motion to the response of the oscillator at rest to an impulse.
Now, for an impulse at $t=\tau$ this is given by
$$
x(t)=\theta(t-\tau)\frac{J}{m\omega_0} \sin \omega_0 (t-\tau)
$$
where $\theta(t)=0$ if $t<0$ and $\theta(t)=1$ if $t>0$.
Your solution is given explicitly by
$$
x(t) = A \cos (\omega_0 t + \phi) + \frac{J}{m\omega_0} \sum_{n=0}^{\infty} \theta(t-n T) \sin \omega_0 (t-nT)
$$
When $NT<t<(N+1)T$ you can write
$$
x(t) = A \cos (\omega_0 t + \phi) + \frac{J}{m\omega_0} \sum_{n=0}^{N}  \sin \omega_0 (t-nT)
$$
and using the complex representation of the sine function
$$
x(t) = A \cos (\omega_0 t + \phi) + \frac{J}{2i m\omega_0} \left[e^{i\omega_0 t} \sum_{n=0}^{N}  e^{-i \omega_0 nT}-e^{-i\omega_0 t} \sum_{n=0}^{N}  e^{i \omega_0 n T}\right]
$$
Now we can sum the two geometric series obtaining
$$
x(t) = A \cos (\omega_0 t + \phi) + \frac{J}{2i m\omega_0} \left[e^{i\omega_0 t} \frac{1-e^{-i \omega_0 (N+1)T}}{1-e^{-i \omega_0 T}}-e^{i\omega_0 t} \frac{1-e^{i \omega_0 (N+1)T}}{1-e^{i \omega_0 T}}\right]
$$
which gives
$$
x(t) = A \cos (\omega_0 t + \phi) + \frac{J}{m\omega_0} \left[a_N\cos \omega_0 t+ b_N\sin \omega_0 t\right]
$$
where
$$
a_N = \mbox{Re} \frac{1-e^{-i \omega_0 (N+1)T}}{1-e^{-i \omega_0 T}}
= \frac{1}{2} \left[1+\frac{\sin (N+\frac{1}{2}) \omega_0 T}{\sin \frac{1}{2} \omega_0 T} \right]
$$
and
$$
b_N = \mbox{Im} \frac{1-e^{-i \omega_0 (N+1)T}}{1-e^{-i \omega_0 T}}
= - \frac{\sin (N+\frac{1}{2})\omega_0 T\sin \frac{N}{2}\omega_0 T}{\sin \frac{1}{2} \omega_0 T}
$$
The coefficients $a_N$ and $b_N$ does not grow with $N$. The only problematic point is when $\omega_0 T = 2k\pi$.  In this case we find directly
$$
x(t) = A \cos (\omega_0 t + \phi) + \frac{J(N+1)}{m\omega_0} \sin \omega_0 t
$$
