Solving differential equation with step function without using Laplace Transforms.

576 Views Asked by At

Suppose we have the differential equation:

$$ \ddot{y} + y = H(x - \pi) - H(x - 2\pi) $$

where $ H(x)$ is the Heaviside step function with initial conditions $ y(0) = \dot{y}(0) = 0 $ as initial conditions, and $ y(x) $ and $ \dot{y}(x) $ are continuous everywhere. I know how to solve this using Laplace Transforms, but I was curious if there are any alternative approaches for solving this and differential equations involving step functions in general.

2

There are 2 best solutions below

3
On BEST ANSWER

You could solve the ODE on $(-\infty, \pi)$, $(\pi, 2\pi)$ and $(2\pi,+\infty)$ separately.

This gives you that $$y(x)=\left \{ \begin{array}{ccc} \alpha_0\cos x + \beta_0\sin x && \text{ if } x<\pi\\ \alpha_1\cos x + \beta_1\sin x + 1&& \text{ if } \pi<x<2\pi\\ \alpha_2\cos x + \beta_2\sin x && \text{ if } 2\pi<x\\ \end{array} \right.$$

Once it's done, you can adjust the constants.

From the boundary condition at $0$, you obtain $\alpha_0=\beta_0=0$.

From the fact that $y$ and $\dot y$ are continuous at $\pi$, you get $-\alpha_1+1=0$ and $-\beta_1=0$.

Finally, from the fact that $y$ and $\dot y$ are continuous at $2\pi$, you get $\alpha_1+1=\alpha_2$ and $\beta_1=\beta_2$. So $\alpha_2=2$ and $\beta_2=0$.

Thus $$y(x)=\left \{ \begin{array}{ccc} 0 && \text{ if } x<\pi\\ \cos x + 1&& \text{ if } \pi<x<2\pi\\ 2\cos x && \text{ if } 2\pi<x\\ \end{array} \right.$$ which you can rewrite as $$y(x)= H(x-\pi)(1+\cos x) + 2H(x-2\pi)\cos x$$

1
On

Without the Laplace transform the solution is as follows. Using $$ H(t - \pi) - H(t - 2 \pi) = \begin{cases} 0 & t < \pi \\ 1 & \pi < t < 2 \pi \\ 0 & t > 2 \pi \end{cases} $$ then $$\begin{cases} y_{1}^{''} + a^2 \, y_{1} \\ y_{2}^{''} + a^2 \, y_{2} \\ y_{3}^{''} + a^2 \, y_{3} \end{cases} = \begin{cases} 0 & t < \pi \\ 1 & \pi < t < 2 \pi \\ 0 & t > 2 \pi \end{cases}. $$ This gives the general solutions $$ y(t) = \begin{cases} y_{1} = A_{0} \, \cos(a t) + A_{1} \, \sin(a t) & t < \pi \\ y_{2} = B_{0} \, \cos(a t) + B_{1} \, \sin(a t) + \frac{1}{a^2} & \pi < t < 2 \pi \\ y_{3} = C_{0} \, \cos(a t) + C_{1} \, \sin(a t) & t > 2 \pi \end{cases}. $$ The given boundary condition, $y(0) = y^{'}(0) = 0$ apply to $y_{1}$ and leads to $$ y(t) = \begin{cases} y_{1} = 0 & t < \pi \\ y_{2} = B_{0} \, \cos(a t) + B_{1} \, \sin(a t) + \frac{1}{a^2} & \pi < t < 2 \pi \\ y_{3} = C_{0} \, \cos(a t) + C_{1} \, \sin(a t) & t > 2 \pi \end{cases}. $$ Now using $y_{1}(\pi) = y_{2}(\pi)$ and $y^{'}_{1}(\pi) = y_{2}^{'}(\pi)$ then $0 = B_{0} \, \cos(a \pi) + B_{1} \, \sin(a \pi) + \frac{1}{a^2}$ and $0 = -a \, (B_{0} \sin(a \pi) - B_{1} \, \cos(a \pi) )$ which gives $$ y(t) = \begin{cases} y_{1} = 0 & t < \pi \\ y_{2} = \frac{2}{a^2} \, \cos^{2}\left(\frac{a t - a \pi}{2}\right) & \pi < t < 2 \pi \\ y_{3} = C_{0} \, \cos(a t) + C_{1} \, \sin(a t) & t > 2 \pi \end{cases}. $$ The remaining conditions $y_{2}(2 \pi) = y_{3}(2 \pi)$ and $y_{2}^{'}(2 \pi) = y_{3}^{'}(2 \pi)$ lead to the final solution of $$ y(t) = \begin{cases} 0 & t < \pi \\ \frac{2}{a^2} \, \cos^{2}\left(\frac{a t - a \pi}{2}\right) & \pi < t < 2 \pi \\ \frac{1}{a^2} \, \left( \cos(a t - a \pi) + \cos(a t - 2 a \pi) \right) & t > 2 \pi \end{cases}. $$ This can also be seen in the form $$ y(t) = \frac{2}{a^2} \, \cos^{2}\left(\frac{a t - a \pi}{2}\right) \, H(t - \pi) - \frac{2}{a^2} \, \sin^{2}\left(\frac{a t - 2 a \pi}{2}\right) \, H(t - 2 \pi). $$

By using the Laplace transform the solution is seen as follows.

Fist note that $$ L\left\{ H(t - a) \right\} = \int_{0}^{\infty} e^{-s t} \, H(t -a) \, dt = \int_{a}^{\infty} e^{-s t} \, dt = \frac{e^{- a s}}{s}. $$ Now, \begin{align} L\{ y^{''} + a^2 \, y \} &= L\left\{ H(t - \pi) - H(t - 2 \pi) \right\} \\ (s^2 + a^2) \, \overline{y} - s \, y(0) - y^{'}(0) &= \frac{e^{-\pi s}}{s} - \frac{e^{-2 \pi s}}{s} \\ \overline{y} &= \frac{e^{- pi s}}{s \, (s^2 + a^2)} - \frac{e^{- pi s}}{s \, (s^2 + a^2)} + \frac{s}{s^2 + a^2} \, y(0) + \frac{y^{'}(0)}{s^2 + a^2}. \end{align} Since $$ \frac{1}{s \, (s^2 + a^2)} = \frac{1}{a^2 \, s} - \frac{1}{a^2 \, (s^2 + a^2)} $$ then $$ \overline{y} = \frac{1}{a^2} \left( \frac{e^{- \pi s}}{s} - \frac{s \, e^{- \pi s}}{s^2 + a^2} - \frac{e^{- 2 \pi s}}{s} + \frac{s \, e^{- 2 \pi s}}{s^2 + a^2} \right) + \frac{s}{s^2 + a^2} \, y(0) + \frac{y^{'}(0)}{s^2 + a^2}. $$ The Laplace inversion gives \begin{align} y(t) &= \frac{1}{a^2} \, \left( (1+\cos(a t - a \pi)) \, H(t - \pi) - (1 - \cos(a t - 2 a \pi)) \, H(t - 2 \pi) \right) \\ & \hspace{10mm} + y(0) \, \cos ( a t) + \frac{y^{'}(0)}{a} \, \sin(a t) \end{align} or \begin{align} y(t) &= \frac{2}{a^2} \, \cos^{2}\left(\frac{a t - a \pi}{2}\right) \, H(t - \pi) - \frac{2}{a^2} \, \sin^{2}\left(\frac{a t - 2 a \pi}{2}\right) \, H(t - 2 \pi) \\ & \hspace{15mm} + y(0) \, \cos ( a t) + \frac{y^{'}(0)}{a} \, \sin(a t). \end{align} With the conditions $y(0) = y^{'}(0) = 0$ and making use of the Heaviside step function definition then the solution can be seen in regions as: $$ y(t) = \begin{cases} 0 & t<\pi \\ \frac{1}{a^2} & t = \pi \\ \frac{2}{a^2} \, \cos^{2}\left(\frac{a t - a \pi}{2}\right) & \pi < t < 2 \pi \\ \frac{2}{a^2} \, \cos^{2}\left(\frac{a \pi}{2}\right) & t = 2 \pi \\ \frac{1}{a^2} \, \left( \cos(a t - a \pi) + \cos(a t - 2 a \pi) \right) & t > 2 \pi \end{cases}. $$