Convolution
The Laplace transform of a product is not the product of the transforms. But the product of two transforms is the transform of something useful: the convolution
The convolution theorem
So whenever is a product of two known transforms, . Convolution is commutative (), associative and linear in each argument.
Example. with and :
import sympy as sp
t, tau, s = sp.symbols("t tau s", positive=True)
conv = sp.integrate(tau * sp.exp(-(t - tau)), (tau, 0, t))
print("t * e^-t =", sp.simplify(conv))
print("inverse transform:", sp.inverse_laplace_transform(1 / (s**2 * (s + 1)), s, t))t * e^-t = t - 1 + exp(-t)
inverse transform: t - 1 + exp(-t)
Response to any input
For with zero initial conditions, transforming gives
is the transfer function. Its inverse is the impulse response (see The Dirac Delta), and by the convolution theorem
The output is a weighted average of past inputs, with weights given by . This is the same formula as the Green's function, now derived in one line.
Numerically: discrete convolution
Sampled on a grid with spacing , the integral becomes a sum, which np.convolve computes. For we have :
import numpy as np
from scipy.integrate import solve_ivp
dt = 0.001
t = np.arange(0, 10, dt)
f = np.where(t < 3, t, 0.0) # a ramp that stops at t = 3
h = np.sin(t)
y_conv = np.convolve(h, f)[: len(t)] * dt # Riemann sum of the convolution integral
ff = lambda tt: tt if tt < 3 else 0.0
sol = solve_ivp(lambda tt, Y: [Y[1], ff(tt) - Y[0]], (0, 10), [0, 0], t_eval=[2.0, 5.0, 9.0], max_step=0.01, rtol=1e-10)
for tv, yv in zip(sol.t, sol.y[0]):
print(f"t = {tv}: convolution {y_conv[int(round(tv / dt))]: .4f}, ODE solver {yv: .4f}")t = 2.0: convolution 1.0907, ODE solver 1.0907
t = 5.0: convolution 0.6184, ODE solver 0.6197
t = 9.0: convolution 2.1894, ODE solver 2.1890
The small differences come from the Riemann-sum approximation; they shrink with .
Volterra integral equations
Convolution also solves integral equations like
Transforming: , so and .
In software
- Convolution is everywhere in signal processing: audio effects (reverb with a measured impulse response), image blurs and sharpening, and the convolutional layers of neural networks (which actually compute cross-correlations, the same idea without flipping).
- Large convolutions are computed with the FFT: the convolution theorem for Fourier transforms is the same trick as here (Fourier Analysis & Signals).
Exercises
Exercise 1: A convolution by hand
Compute and .
Answer
and .
Solution
and . Check with transforms: and .
Exercise 2: Inverse by convolution
Find as .
Answer
.
Solution
.
Exercise 3: Integral equation (code)
Solve with the Laplace transform and check with SymPy.
Answer
.
Solution
The integral is , so and .
import sympy as sp
s, t = sp.symbols("s t", positive=True); Y = sp.symbols("Y")
Ys = sp.solve(sp.Eq(Y, 1 / s + Y / s), Y)[0]
print(Ys, "->", sp.inverse_laplace_transform(Ys, s, t))1/(s - 1) -> exp(t)
Test yourself
The convolution theorem states $\mathcal{L}\{f * g\} = $…
For zero initial conditions, the output of a linear system is…
- the input times the transfer function in the time domain
- the convolution of the impulse response with the input
- always zero
- the derivative of the input
for is…
- 1
- 0