I want to solve
$$y''+\omega^2y=f(t)\,,\,y(0)=y'(0)=0$$
where $f(t)=\sum_{k=0}^{\infty} (-1)^ku_k(t)$ is the square wave, $u_k(t)$ the unit step function jumping at $t=k$. I am not sure how to find the Laplace transform of the infinite sum. Taking Laplace transforms of both sides I get $$Y(s)=\frac{1}{s(s^2+\omega^2)}(\sum_{k=0}^{\infty} (-1)^ke^{-ks}).$$ The inverse of $\frac{1}{s(s^2+\omega^2)}$ I worked out ut to be $\frac{1}{\omega^2}u_0(t)-\frac{1}{\omega^2}\cos(\omega t)$. According to Wolfram Alpha $\sum_{k=0}^{\infty} (-1)^ke^{-ks}=\frac{e^s}{1+e^s}$ (?), but I cannot see what the inverse of that could be.
Best Answer
Well, usually we write for the unit step function:
$$\theta\left(t-\text{k}\right)\tag1$$
So, we want to find:
So, we get:
$$\text{s}^2\cdot\text{Y}\left(\text{s}\right)-\text{s}\cdot\text{y}\left(0\right)-\text{y}\space'\left(0\right)+\omega^2\cdot\text{Y}\left(\text{s}\right)=\frac{1}{\text{s}}\cdot\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}\space\Longleftrightarrow\space$$ $$\text{Y}\left(\text{s}\right)=\frac{\frac{1}{\text{s}}\cdot\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}+\text{s}\cdot\text{y}\left(0\right)+\text{y}\space'\left(0\right)}{\text{s}^2+\omega^2}\tag5$$
Now, for the inverse Laplace transform:
$$\text{y}\left(t\right)=\mathscr{L}_\text{s}^{-1}\left[\frac{\frac{1}{\text{s}}\cdot\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}+\text{s}\cdot\text{y}\left(0\right)+\text{y}\space'\left(0\right)}{\text{s}^2+\omega^2}\right]_{\left(t\right)}=$$ $$\mathscr{L}_\text{s}^{-1}\left[\frac{1}{\text{s}}\cdot\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}\cdot\frac{1}{\text{s}^2+\omega^2}\right]_{\left(t\right)}+\mathscr{L}_\text{s}^{-1}\left[\frac{\text{s}\cdot\text{y}\left(0\right)+\text{y}\space'\left(0\right)}{\text{s}^2+\omega^2}\right]_{\left(t\right)}=$$ $$\int_0^t\mathscr{L}_\text{s}^{-1}\left[\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}\cdot\frac{1}{\text{s}^2+\omega^2}\right]_{\left(\tau\right)}\space\text{d}\tau+\text{y}\left(0\right)\cdot\cos\left(\omega t\right)+\frac{\text{y}\space'\left(0\right)\cdot\sin\left(\omega t\right)}{\omega}\tag6$$
Use:
$$\mathscr{L}_\text{s}^{-1}\left[\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}\cdot\frac{1}{\text{s}^2+\omega^2}\right]_{\left(\tau\right)}=\int_0^\tau\mathscr{L}_\text{s}^{-1}\left[\frac{1+2\cdot e^\text{s}}{1+e^\text{s}}\right]_{\left(\sigma\right)}\cdot\mathscr{L}_\text{s}^{-1}\left[\frac{1}{\text{s}^2+\omega^2}\right]_{\left(t-\sigma\right)}\space\text{d}\sigma=$$ $$\int_0^\tau\left\{\sum_{\text{k}=0}^\infty\left(-1\right)^\text{k}\cdot\theta\left(\sigma-\text{k}\right)\right\}\cdot\frac{\sin\left(\omega\cdot\left(\tau-\sigma\right)\right)}{\omega}\space\text{d}\sigma=$$ $$\sum_{\text{k}=0}^\infty\frac{\left(-1\right)^\text{k}}{\omega}\cdot\left\{\int_0^\tau\theta\left(\sigma-\text{k}\right)\cdot\sin\left(\omega\cdot\left(\tau-\sigma\right)\right)\space\text{d}\sigma\right\}\tag7$$