Processing math: 8%

Preface


This is a tutorial made solely for the purpose of education and it was designed for students taking Applied Math 0330. It is primarily for students who have very little experience or have never used Mathematica before and would like to learn more of the basics for this computer algebra system. As a friendly reminder, don't forget to clear variables in use and/or the kernel.

Finally, the commands in this tutorial are all written in bold black font, while Mathematica output is in normal font. This means that you can copy and paste all commands into Mathematica, change the parameters and run them. You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the second course APMA0330
Return to Mathematica tutorial for the first course APMA0340
Return to the main page for the course APMA0340
Return to the main page for the course APMA0330
Return to Part VI of the course APMA0330

Convolution


If functions f and g are piecewise continuous on [0,), then the integral

fg(t)=gf(t)=0f(τ)g(tτ)dτ=0g(τ)f(tτ)dτ
is called the convolution of f and g and is denoted by fg(t).

Theorem: If f and g are piecewise continuous on [0,), and of exponential order, then

{\cal L} \left[ f*g \right] (\lambda ) = {\cal L} \left[ g \right] {\cal L} \left[ f \right] = f^L \, g^L = g^L \, f^L . \qquad ■

Example: Evaluate the Laplace transform of the convolution integral

{\cal L} \left[ \int_0^t {\text d} \tau\, e^{3\tau} \,\cos \left( t- \tau \right) \right] .
With f(t) = e^{3t} and g(t) = \cos t , the convolution theorem states that the Laplace transform of the convolution of f and g is the product of their Laplace transforms:
{\cal L} \left[ \int_0^t {\text d} \tau\, e^{3\tau} \,\cos \left( t- \tau \right) \right] = {\cal L} \left[ f \right] {\cal L} \left[ g \right] = f^L \cdot g^L .
The Laplace transform of each multiple is know from the table
\begin{align*} {\cal L} \left[ f \right] &= {\cal L} \left[ e^{3t} \right] = \frac{1}{\lambda -3} , \\ {\cal L} \left[ g \right] &= {\cal L} \left[ \cos t \right] = \frac{\lambda}{\lambda^2 +1} . \end{align*}
Therefore,
{\cal L} \left[ \int_0^t {\text d} \tau\, e^{3\tau} \,\cos \left( t- \tau \right) \right] = \frac{1}{\lambda -3} \, \frac{\lambda}{\lambda^2 +1} .
Now we check our calculation by explicitly evaluating the convolution integral
\int_0^t {\text d} \tau\, e^{3\tau} \,\cos \left( t- \tau \right) = \frac{1}{10} \left( 3\, e^{3t} -3\,\cos t + \sin t \right) ,
and then apply the Laplace transformation for every term
\frac{1}{10} \,{\cal L} \left[ 3\, e^{3t} -3\,\cos t + \sin t \right] = \frac{1}{10} \left( \frac{3}{\lambda -3} - \frac{3\,\lambda}{\lambda^2 +1} + \frac{1}{\lambda^2 +1} \right) = \frac{3\,(\lambda^2 +1) + (1-3\lambda)(\lambda -3)}{10\,(\lambda -3)(\lambda^2 +1)} = \frac{\lambda}{(\lambda -3)(\lambda^2 +1)} .

Example: For positive numbers a and b, evaluate

{\cal L}^{-1} \left[ \frac{1}{\lambda^2 + a^2} \, \frac{1}{\lambda^2 + b^2} \right] .
Let
f^L (\lambda )= \frac{1}{\lambda^2 + a^2} \qquad\mbox{and} \qquad g^L (\lambda ) = \frac{1}{\lambda^2 + b^2}
be Laplace transforms so that
f (t )= {\cal L}^{-1} \left[ \frac{1}{\lambda^2 + a^2} \right] = \frac{1}{a}\, \sin at \qquad\mbox{and} \qquad g (t ) = {\cal L}^{-1} \left[ \frac{1}{\lambda^2 + b^2} \right] = \frac{1}{b}\, \sin bt .
In this case, the convolution theorem gives
{\cal L}^{-1} \left[ \frac{1}{\lambda^2 + a^2} \, \frac{1}{\lambda^2 + b^2} \right] = \frac{1}{ab} \, \int_0^t {\text d}\tau \, \sin a\tau \,\sin b(t-\tau ) .
With the aid of the trigonometric identity
\sin A\,\sin B = \frac{1}{2} \left[ \cos \left( A - B \right) - \cos \left( A + B \right) \right]
and the substitution A = a\tau \quad\mbox{and} \quad B= b(t-\tau ) , we can carry out the integration
\begin{align*} {\cal L}^{-1} \left[ \frac{1}{\lambda^2 + a^2} \, \frac{1}{\lambda^2 + b^2} \right] &= \frac{1}{ab} \, \int_0^t {\text d}\tau \, \sin a\tau \,\sin b(t-\tau ) \\ &= \frac{1}{2ab} \, \int_0^t {\text d}\tau \left[ \cos \left( a\tau + b \tau -bt \right) - \cos \left( a\tau - b \tau +bt \right) \right] \\ &= \frac{1}{2ab} \left[ \left. \frac{1}{a+b} \,\sin \left( a\tau + b \tau -bt \right) \right\vert_{\tau =0}^{\tau =t} - \left. \frac{1}{a-b} \, \sin \left( a\tau - b \tau +bt \right) \right\vert_{\tau =0}^{\tau =t} \right] \\ &= \left[ \frac{\sin at + \sin bt}{2(a+b)ab} - \frac{\sin at - \sin bt}{2(a-b)ab} \right] H(t) , \end{align*}
where H(t) is the Heaviside function. To check the answer, we apply the Laplace transform to the right-hand side:
{\cal L} \left[ \frac{\sin at + \sin bt}{2(a+b)ab} - \frac{\sin at - \sin bt}{2(a-b)ab} \right] = \frac{1}{\lambda^2 + a^2} \left[ \frac{1}{2(a+b)b} - \frac{1}{2(a-b)b} \right] + \frac{1}{\lambda^2 + b^2} \left[ \frac{1}{2(a+b)a} + \frac{1}{2(a-b)a} \right] .
Since
\frac{1}{2(a+b)b} - \frac{1}{2(a-b)b} = - \frac{1}{a^2 - b^2} \qquad\mbox{and} \qquad \frac{1}{2(a+b)a} + \frac{1}{2(a-b)a} = \frac{1}{a^2 - b^2} ,
we have
{\cal L} \left[ \frac{\sin at + \sin bt}{2(a+b)ab} - \frac{\sin at - \sin bt}{2(a-b)ab} \right] = \frac{1}{a^2 - b^2} \ \left( \frac{-1}{\lambda^2 + a^2} + \frac{1}{\lambda^2 + b^2} \right) = \frac{1}{\lambda^2 + a^2} \, \frac{1}{\lambda^2 + b^2} .

Example: Solve the integral equation

y(t) = 3t^2 - e^{-2t} + \int_0^t y(\tau ) \, e^{2t-2\tau}\, {\text d}\tau
for y(t). We identify the integral in the right-hand side as the convolution of unknown function and the exponential function. We take the Laplace transform of each term:
{\cal L} \left[ y \right] = y^L = {\cal L} \left[ 3t^2 \right] - {\cal L} \left[ e^{-2t} \right] + {\cal L} \left[ \int_0^t y(\tau ) \, e^{2t-2\tau}\, {\text d}\tau \right]
We denote by y^L = \int_0^{\infty} y(t)\, e^{\lambda\,t} \,{\text d}t the Laplace transform of unknown function. Then
\begin{align*} {\cal L} \left[ 3t^2 \right] &= \frac{6}{\lambda^3} , \\ {\cal L} \left[ e^{-2t} \right] &= \frac{1}{\lambda +2} , \\ {\cal L} \left[ \int_0^t y(\tau ) \, e^{2t-2\tau}\, {\text d}\tau \right] &= y^L \,{\cal L} \left[ e^{2t} \right] = y^L \,\frac{1}{\lambda -2} . \end{align*}
Therefore, upon application of the Laplace transform, we get instead of integral equation an algebraic equation:
y^L = \frac{6}{\lambda^3} - \frac{1}{\lambda +2} + y^L \,\frac{1}{\lambda -2} .
Solving for yL, we obtain
y^L = \frac{\lambda -2}{\lambda -3} \left( \frac{6}{\lambda^3} - \frac{1}{\lambda +2} \right) .
Now applying the inverse Laplace transform to the right-hand side expression, we get the required solution
y(t) = \left[ \frac{2}{9} \left( 9t^2 -3t-1 \right) + \frac{1}{45}\, e^{3t} - \frac{4}{5}\, e^{-2t} \right] H(t) .

Example: Determine the current i(t) in a single-loop LRC circuit when L = 0.5 henries, R = 3 ohms, C = 0.2 farads, i(0)=0, and the impressed voltage is

E(t) = 127\,t - 127\,t\, H(t-\pi ) .
In a single-loop circuit, Kirchhoff's second law states that the sum of the voltage drops across an inductor, resistor, and capacitor is equal to the impressed voltage E(t). Then current i(t) is governed by the integrodifferential equation
L\, \frac{{\text d}i}{{\text d}t} + R\, i(t) + \frac{1}{C} \, \int_0^t i(\tau )\,{\text d}\tau = E(t) .
Substituting the given values, we obtain the initial value problem for the integrodifferential equation:
0.5\, \frac{{\text d}i}{{\text d}t} + 3\, i(t) + 5 \, \int_0^t i(\tau )\,{\text d}\tau = 127\,t - 127\,t\, H(t-\pi ) , \qquad i(0) =0.
Application of the Laplace transform to the above problem yields
0.5\, \lambda\, i^L + 3\, i^L + 5 \, i^L \, \frac{1}{\lambda} = E^L = \frac{127}{\lambda^2} \left( 1 - e^{-\lambda\pi} \right) - \frac{127\,\pi}{\lambda} \, e^{-\lambda\pi} .
Solving with respect to the Laplace transform of the unknown current iL, we obtain
i^L (\lambda ) = \frac{2\lambda}{\lambda^2 +6\lambda +10}\, E^L = \frac{254}{\lambda^2 +6\lambda +10} \left[ \frac{1}{\lambda} - \frac{1}{\lambda} \,e^{-\lambda\pi} - \pi\, e^{-\lambda\pi} \right]
To determine the current through application of inverse Laplace transform, we introduce two function
f^L (\lambda ) = \frac{254}{\lambda \left( \lambda^2 +6\lambda +10\right)}\qquad\mbox{and} \qquad g^L (\lambda ) = \frac{254}{\lambda^2 +6\lambda +10} .
Then the required current will be equal to
i(t) = f(t) - f(t-\pi ) - \pi\,g(t-\pi ) ,
where functions f and g are defined by the inverse Laplace transforms:
\begin{align*} f(t) &= {\cal L}^{-1} \left[ \frac{254}{\lambda \left( \lambda^2 +6\lambda +10\right)} \right] , \\ g(t) &= {\cal L}^{-1} \left[ \frac{254}{\lambda^2 +6\lambda +10} \right] . \end{align*}
The denominator in both expressions contains the polynomial Q(\lambda ) = \lambda^2 +6\lambda +10 that has two complex conjugate nulls: \lambda = -3 \pm {\bf j} . Applying the residue method, we find
g(t) = 2\,\mbox{Re} \,\mbox{Res}_{\lambda = -3 + {\bf j}} \, \frac{254}{\lambda^2 +6\lambda +10} \, e^{\lambda \,t} .
The residue is
\mbox{Res}_{\lambda = -3 + {\bf j}} \, \frac{254}{\lambda^2 +6\lambda +10} \, e^{\lambda \,t} = \left. \frac{254}{2\lambda +6} \, e^{\lambda\, t} \right\vert_{\lambda = -3 + {\bf j}} = \frac{127}{\bf j} \, e^{-3t} \, e^{{\bf j} t}.
Extracting the real part, we get
g(t) = 254\,e^{-3t} \,\sin t \, H(t) ,
where H(t) is the Heaviside function. To determine the inverse Laplace transform of the function f^L (\lambda ) , we need to calculate two residues, at \lambda =0 and at \lambda = -3+ {\bf j} . This leads to
\begin{align*} \mbox{Res}_{\lambda = -3 + {\bf j}} \, \frac{254}{\lambda \left( \lambda^2 +6\lambda +10 \right)} \, e^{\lambda \,t} &= \lim_{\lambda \mapsto -3 + {\bf j}} \, \frac{127}{\lambda \left( \lambda +3 \right)} \, e^{\lambda \,t} = - \frac{127}{1 + 3{\bf j}} \,e^{-3t} \, e^{{\bf j} t} \\ \mbox{Res}_{\lambda = 0} \, \frac{254}{\lambda \left( \lambda^2 +6\lambda +10 \right)} \, e^{\lambda \,t} &= \lim_{\lambda \mapsto 0} \, \frac{254}{\lambda^2 +6\lambda +10} \, e^{\lambda \,t} = \frac{127}{5} . \end{align*}
Extracting the real part, we get
f(t) = \left[ \frac{127}{5} - \frac{127}{5}\,e^{-3t} \left( 3\,\sin t + \cos t \right) \right] H(t) ,