Tutorial file 3. MA530. The Laplace Transform.

Examples correspond to O'Neil "Advanced Engineering Mathematics" 6th ed.
	Compare the analytical solutions in the book  with the computer solutions in this file:

Definition of the Laplace Transform

Definition: 
		The Laplace transform 𝔏 [f] of f is a function defined by
		
		𝔏[f]s=(∫_0^∞) (e^(-st)) f(
            t) dt
		
		for all s such that this integral converges.

Example 3.1. p. 108. Calculate the Laplace transform of f(t)=(e^at) using the definition.

Let us write the definition directly:

Integrate[Exp[-s*t] Exp[a*t], {t, 0, ∞}]

The program gives us the correct answer, and consider a and s as complex numbers.

We also can explicitly say that a and s are real numbers:

Integrate[Exp[-s*t] Exp[a*t], {t, 0, ∞}, 
      Assumptions -> {a ∈ Reals, 
          s ∈ Reals}]

Example 3.2. p. 108. Calculate the Laplace transform of f(t)=sin(t) using the definition.

Let us write the definition directly:

Integrate[Exp[-s*t] Sin[t], {t, 0, ∞}]

The program gives us the correct answer, but consider s as a complex number.

We also can explicitly write that a is a real numbers:

Integrate[Exp[-s*t] Sin[t], {t, 0, ∞}, 
      Assumptions -> s ∈ Reals]

Calculate the Laplace transform of f(t)=δ(t - a) using the definition.

Integrate[
      Exp[-s*t] DiracDelta[t - a], {t, 0, ∞}]

Calculate the Laplace transform of f(t)=sinh(ta) using the definition.

Integrate[Exp[-s*t] Sinh[a*t], {t, 0, ∞}]

Using functions: LaplaceTransform[expr,t,s] and InverseLaplaceTransform[expr,s,t]

Example :  f (t)=(e^at)

Calculate the Laplace transform of f(t)=(e^at)

LaplaceTransform[Exp[a*t], t, s]

Calculate an inverse Laplace transform of (1/(-a + s))

InverseLaplaceTransform[(1/(-a + s)), s, t]

Example :  f (t) = sin (t)

Calculate the Laplace transform of f(t)=sin(t)

LaplaceTransform[Sin[t], t, s]

Calculate an inverse Laplace transform of (1/(1 + (s^2)))

InverseLaplaceTransform[(1/(1 + (s^2))), s, t]

Example :  f (t) = δ (t - a)

Calculate the Laplace transform of f(t)=δ(t - a)

LaplaceTransform[DiracDelta[t - a], t, s]

Calculate an inverse Laplace transform of (e^(-a s))

InverseLaplaceTransform[Exp[-a*s], s, t]

Example :  f (t) = sinh (ta)

Calculate the Laplace transform of f(t)=sinh(ta) using the definition.

LaplaceTransform[Sinh[a*t], t, s]

Calculate an inverse Laplace transform of (a/(-(a^2) + (s^2)))

InverseLaplaceTransform[(a/(-(a^2) + (s^2))), s, t]

Laplace Transform of derivates

LaplaceTransform[f'[t], t, s]

LaplaceTransform[f''[t], t, s]

LaplaceTransform[Derivative[3][f[t]][t], t, s]

Solution of initial value problems

Example 3.3 p. 117  Solve y'-4y=1, y(0)=1

LaplaceTransform[y'[t] - 4*y[t], t, s] == 
      LaplaceTransform[1, t, s]

% /. {LaplaceTransform[y[t], t, s] -> Y[s], 
        y[0] -> 1}

Solve[%, Y[s]]

InverseLaplaceTransform[((1 + s)/((-4 + s) s)), s, 
      t]

Example 3.4 p. 118  Solve y''+4y'+3y=Exp[t];  y(0)=0, y'(0)=2

LaplaceTransform[y''[t] + 4*y'[t] + 3*y[t], t, s] == 
      LaplaceTransform[Exp[t], t, s]

% /. {LaplaceTransform[y[t], t, s] -> Y[s],  
        y[0] -> 0, y'[0] -> 2}

Solve[%, Y[s]]

InverseLaplaceTransform[((-1 + 2 s)/((-1 + s) (3 + 4 s + (s^2)))), s, t]

Solve y''+y=t;  y(0)=1, y'(0)=0

LaplaceTransform[y''[t] + y[t], t, s] == 
      LaplaceTransform[t, t, s]

% /. {LaplaceTransform[y[t], t, s] -> Y[s],  
        y[0] -> 1, y'[0] -> 0}

Solve[%, Y[s]]

InverseLaplaceTransform[((1 + (s^3))/((s^2) (1 + (s^2)))), s, 
      t]

The First Shifting Theorem

Example 3.5 p. 121 Laplace transforms of cos(bt) and Exp[at]cos(bt)

LaplaceTransform[Cos[b*t], t, s]

LaplaceTransform[Exp[a*t] Cos[b*t], t, s]

Example 3.6 p. 121 Laplace transforms of t^3 and Exp[at]t^3

LaplaceTransform[t^3, t, s]

LaplaceTransform[Exp[a*t] t^3, t, s]

Example 3.7 p. 121 Inverse Laplace transform of 4/(s^2+4s+20)

InverseLaplaceTransform[4/(s^2 + 4*s + 20), s, t]

FullSimplify[%]

The Heaviside Function and Pulses

In Mathematica the Heaviside function if given by the operator UnitStep[x]

u[x_] = UnitStep[x];

Plot[u[x], {x, -5, 5}, PlotRange -> {-1, 2}, 
        AxesOrigin -> {-0.5, -0.5}];

Consider the following example  :  H (t - Pi) 
            cos (t) (see page 124  
                of the textbook):

Plot[u[x - Pi]*Cos[x], {x, -3, 15}, PlotRange -> {-1, 1.5}, 
        AxesOrigin -> {0, -0.5}];

Example of the pulse : ( H (t - 1) - H (t - 2)) 
            Exp[t] (see page 124  
                of the textbook):

Plot[(UnitStep[t - 1] - UnitStep[t - 2])*Exp[t], {t, 0, 3}, 
        PlotRange -> {-1, 10}, AxesOrigin -> {0, -0.5}];

Solution of the initial value problems with discontinuous forcing functions.

Example 3.13 p. 127 Solve the initial value problem y''+4y=f(t); y(0)=y'(0)=0, where f(t)=0 for t<3, and f(t)=t for t=>3

LaplaceTransform[y''[t] + 4*y[t], t, s] == 
      LaplaceTransform[UnitStep[t - 3] t, t, s]

% /. {LaplaceTransform[y[t], t, s] -> Y[s], 
        y[0] -> 0, y'[0] -> 0}

Solve[%, Y[s]]

solution[t_] = 
      InverseLaplaceTransform[(((E^(-3 s)) (1 + 3 s))/((s^2) (4 + (s^2)))), s, t]

Compare the following plot with Fig .  3.17  p .  
        129

Plot[solution[t], {t, 0, 10}, PlotRange -> {-1, 4}, 
        AxesOrigin -> {0, -0.5}];

In Mathematica we can also solve this initial value problem numerically using function NDSolve:

NDSolve[ {y''[t]+4y[t] == If[t <= 3, 0, t], y[0] == 0, y'[0] == 0}, y, {t, 0, 10}, MaxSteps->1000]

Plot[Evaluate[y[t]/. %], {t, 0, 10}, PlotRange -> {-1, 4}, AxesOrigin -> {0,-0.5}];