Timedora

Laplace Transforms for Piecewise Forcing

A lesson on encoding switching inputs with unit steps, solving an initial-value problem using Laplace transforms, and checking the solution across a switch.

Encode switches and shift delayed terms

Encode switches with unit steps

A unit step represents an input that changes abruptly at a specified time. At time aa,

u(t−a)={0,t<a,1,t≥a.u(t-a)=\begin{cases}0,&t<a,\\1,&t\ge a.\end{cases}

For example, a force that is 11 before aa and −1-1 from aa onward can be written

f(t)=1−2u(t−a).f(t)=1-2u(t-a).

Before the switch, u(t−a)=0u(t-a)=0, so the force is 11. At and after the switch, u(t−a)=1u(t-a)=1, so the force becomes 1−2=−11-2=-1. More generally, if a forcing changes from f0(t)f_0(t) to f1(t)f_1(t) at aa, write

f(t)=f0(t)+u(t−a)(f1(t)−f0(t)).f(t)=f_0(t)+u(t-a)\bigl(f_1(t)-f_0(t)\bigr).

Before aa, the step contributes nothing and leaves f0(t)f_0(t). After aa, it adds the difference between the new and old forcing, giving f1(t)f_1(t).

Shift delayed terms

The says that if G(s)=L{g(t)}G(s)=\mathcal L\{g(t)\}, then

L{u(t−a)g(t−a)}=e−asG(s),L−1{e−asG(s)}=u(t−a)g(t−a).\mathcal L\{u(t-a)g(t-a)\}=e^{-as}G(s), \qquad \mathcal L^{-1}\{e^{-as}G(s)\}=u(t-a)g(t-a).

The exponential factor in the transform domain signals a delay in time. Crucially, the delay applies to the entire function: the inverse transform contains g(t−a)g(t-a), not g(t)g(t). Thus, when inverting a term multiplied by e−ase^{-as}, first identify the rest as G(s)G(s), find its inverse g(t)g(t), and then write u(t−a)g(t−a)u(t-a)g(t-a).

Solve the initial-value problem

Solve the initial-value problem

Consider the source example

y′′+y=f(t),y(0)=2,y′(0)=−1,y''+y=f(t),\qquad y(0)=2,\qquad y'(0)=-1,

where the force is 11 for 0≤t<π/20\le t<\pi/2 and −1-1 for t≥π/2t\ge\pi/2. Set a=π/2a=\pi/2. Since the force drops by 2 at the switch, its unit-step form is

f(t)=1−2u(t−a),L{f(t)}=1−2e−ass.f(t)=1-2u(t-a),\qquad \mathcal L\{f(t)\}=\frac{1-2e^{-as}}{s}.

Let Y(s)=L{y(t)}Y(s)=\mathcal L\{y(t)\}. Use the initial conditions in the derivative transform:

L{y′′}=s2Y−sy(0)−y′(0)=s2Y−2s+1.\mathcal L\{y''\}=s^2Y-sy(0)-y'(0)=s^2Y-2s+1.

Transforming both sides of the differential equation therefore gives

(s2+1)Y−2s+1=1−2e−ass.(s^2+1)Y-2s+1=\frac{1-2e^{-as}}{s}.

Isolate YY by moving the initial-condition terms to the right and dividing by s2+1s^2+1:

Y(s)=1−2e−ass(s2+1)+2s−1s2+1.Y(s)=\frac{1-2e^{-as}}{s(s^2+1)}+\frac{2s-1}{s^2+1}.

Now invert each part. The ordinary, non-delayed terms use
L−1{1/[s(s2+1)]}=1−cos⁡t\mathcal L^{-1}\{1/[s(s^2+1)]\}=1-\cos t,
L−1{2s/(s2+1)}=2cos⁡t\mathcal L^{-1}\{2s/(s^2+1)\}=2\cos t, and
L−1{1/(s2+1)}=sin⁡t\mathcal L^{-1}\{1/(s^2+1)\}=\sin t. For the term containing e−ase^{-as}, apply the to the whole factor 1/[s(s2+1)]1/[s(s^2+1)]: its inverse is 1−cos⁡t1-\cos t, so its delayed version is u(t−a)[1−cos⁡(t−a)]u(t-a)[1-\cos(t-a)]. Combining the terms yields

y(t)=1+cos⁡t−sin⁡t−2u(t−a)(1−cos⁡(t−a)).y(t)=1+\cos t-\sin t-2u(t-a)\bigl(1-\cos(t-a)\bigr).

Before the switch the step is zero, giving y(t)=1+cos⁡t−sin⁡ty(t)=1+\cos t-\sin t. Afterward, substitute a=π/2a=\pi/2, so cos⁡(t−a)=sin⁡t\cos(t-a)=\sin t, to obtain y(t)=−1+cos⁡t+sin⁡ty(t)=-1+\cos t+\sin t.

Check the solution at the switch

Check the solution at the switch

A solution to a piecewise-forced problem should be checked in three ways: test the initial conditions, verify the equation on each interval, and compare the one-sided values of the solution and its first derivative at the switch. For this example, the interval formulas are

y(t)={1+cos⁡t−sin⁡t,0≤t<π/2,−1+cos⁡t+sin⁡t,t≥π/2.y(t)=\begin{cases} 1+\cos t-\sin t,&0\le t<\pi/2,\\ -1+\cos t+\sin t,&t\ge\pi/2. \end{cases}

At the initial time, the first formula gives y(0)=2y(0)=2. Its derivative is −sin⁡t−cos⁡t-\sin t-\cos t, so y′(0)=−1y'(0)=-1, as required.

At t=π/2t=\pi/2, the left formula gives 1+0−1=01+0-1=0, and the right formula gives −1+0+1=0-1+0+1=0. Thus the one-sided values of yy agree. The derivatives on the two intervals are, respectively,

yleft′=−sin⁡t−cos⁡t,yright′=−sin⁡t+cos⁡t.y'_{\text{left}}=-\sin t-\cos t, \qquad y'_{\text{right}}=-\sin t+\cos t.

Both give −1-1 at the switch, so y′y' is continuous there as well.

Finally, differentiate again and check the equation separately on the open intervals. Before the switch, y′′=−cos⁡t+sin⁡ty''=-\cos t+\sin t, hence y′′+y=1y''+y=1. After it, y′′=−cos⁡t−sin⁡ty''=-\cos t-\sin t, hence y′′+y=−1y''+y=-1. These match the forcing on their respective intervals.

The second derivative need not be continuous: its left-hand limit at the switch is 11, while its right-hand limit is −1-1. For an ordinary differential equation with piecewise-continuous forcing, it is yy and y′y' that remain continuous; y′′y'' may jump. The equation is checked on the open intervals between switches, and at the switching instant the relevant check is the one-sided behavior—not a requirement that the differential equation hold there using a single value of the discontinuous forcing.

  • : The unit step u(t-a) is 0 for t<a and 1 for t≥a.