({{, (RefLink[Convolve, paclet:ref/Convolve])[f,g,x,y] 
gives the convolution with respect to x of the expressions f and g.}, {, (RefLink[Convolve, paclet:ref/Convolve])[f,g,{(Subscript[x, 1]),(Subscript[x, 2]),…},{(Subscript[y, 1]),(Subscript[y, 2]),…}]
gives the multidimensional convolution.}})

OpenersNotesSection(Spacer1)Details and Options

The convolution (f* g) (y) of two functions f(x) and g(x) is given by (∫_(-∞)^∞)f(x) g(y-x)dx.

The multidimensional convolution is given by (∫_(-∞)^∞)(∫_(-∞)^∞)⋯ f((Subscript[x, 1]),(Subscript[x, 2]),…) g((Subscript[y, 1])-(Subscript[x, 1]),(Subscript[y, 2])-(Subscript[x, 2]),…)d(Subscript[x, 1])d(Subscript[x, 2]) ⋯.

The following options can be given:

OpenersPrimaryExamplesSection(Spacer1)Examples  (22)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Convolve two functions:

Convolve[DiracDelta[x],f[x],x,y]

Convolve[Exp[-x]UnitStep[x],Sin[x],x,y]

A typical impulse response h for a system:

h=Exp[-x]UnitStep[x];

Plot[h,{x,0,10},PlotRange->All]

The step response corresponding to the same system:

Convolve[h,UnitStep[x],x,y]

Plot[%,{y,0,10},PlotRange->All]

OpenersExampleSection1(Spacer1)Scope  (5)

OpenersExampleSubsection0(Spacer1)Univariate Convolution  (3)

The convolution gives the product integral of translates:

f[x_]:=UnitBox[x]

g[x_]:=E^(-x^2)

GraphicsRow@Table[Plot[{f[x],g[x-i]},{x,-3,4},Ticks->None, 
PlotRange -> All], {i, -1, 2}]

Convolve[f[x],g[x],x,y]

Elementary functions:

Convolve[x,1/(x^2+1),x,y]

Convolve[E^(-a x^2),1,x,y]

A convolution typically smooths the function:

f0=UnitBox[t0];

f1=Convolve[f0,f0,t0,t1]

f2=Convolve[f1,f1,t1,t2]

f3=Convolve[f2,f2,t2,t3];

Plot[Evaluate[{f0,f1,f2,f3}/.{t0->x,t1->x,t2->x,t3->x}],{x,-3,3}]

For this family, they all have unit area:

Integrate[Evaluate[{f0,f1,f2,f3}/.{t0->x,t1->x,t2->x,t3->x}],{x,-∞,∞}]

OpenersExampleSubsection1(Spacer1)Multivariate Convolution  (2)

The convolution gives the product integral of translates:

f[x_,y_]:=E^(-x^2-y^2)

GraphicsGrid@Table[Plot3D[{f[x,y],f[x-i,y-j]},{x,-3,3},{y,-3,3},Mesh->5,ImageSize->400,Ticks->None, 
PlotRange -> All,PlotStyle->{LightRed,LightOrange}], {i, -1, 1},{j,-1,1}]

Convolution with multivariate delta functions acts as a point operator:

Convolve[f[x,y],DiracDelta[x,y],{x,y},{r,s}]

Convolution with a function of bounded support acts as a filter:

Convolve[E^(- x ^2-y^2),UnitBox[x,y],{x,y},{r,s}]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

Multiplication by (RefLink[UnitStep, paclet:ref/UnitStep]) effectively gives the convolution on a finite interval:

Convolve[x^5 UnitStep[x],Sin[x] UnitStep[x],x,y,Assumptions->y>0]

Integrate[x^5 Sin[y-x],{x,0,y},Assumptions -> y>0]

OpenersExampleSection3(Spacer1)Options  (2)

OpenersExampleSubsection2(Spacer1)Assumptions  (1)

Specify assumptions on a variable or parameter:

Convolve[a^x UnitStep[x],UnitStep[x],x,y]

Convolve[a^x UnitStep[x],UnitStep[x],x,y,Assumptions->y>0]

OpenersExampleSubsection3(Spacer1)GenerateConditions  (1)

Generate conditions for the range of a parameter:

Convolve[E^(-a x^2),x^3,x,y,GenerateConditions->True]

OpenersExampleSection4(Spacer1)Applications  (5)

Obtain a particular solution for a linear ordinary differential equation using convolution:

First@Simplify[y[x]/.DSolve[{y'[x]+y[x]==x^2,y[0]==0},y,x]]

Expand[Simplify[Convolve[E^(-t)UnitStep[t],t^2 UnitStep[t],t,x],x >0]]

The convolution of (RefLink[UnitBox, paclet:ref/UnitBox]) with itself is (RefLink[UnitTriangle, paclet:ref/UnitTriangle]):

Convolve[UnitBox[x],UnitBox[x],x,t]

Plot[%, {t,-1,1}]

Convolving the (RefLink[PDF, paclet:ref/PDF]) of (RefLink[UniformDistribution, paclet:ref/UniformDistribution]) with itself gives a (RefLink[TriangularDistribution, paclet:ref/TriangularDistribution]):

Convolve[PDF[UniformDistribution[{0,1}],x],PDF[UniformDistribution[{0,1}],x],x,y]

PDF[TriangularDistribution[{0,2}],y]

FullSimplify[%%-%]

(RefLink[UniformSumDistribution, paclet:ref/UniformSumDistribution])[n] is the convolution of n (RefLink[UniformDistribution, paclet:ref/UniformDistribution])[] PDFs:

Table[Convolve[PDF[UniformSumDistribution[k],x],PDF[UniformDistribution[{0,1}],x],x,y]-PDF[UniformSumDistribution[k+1],y],{k,2,5}]//FullSimplify

Table[Plot[PDF[UniformSumDistribution[k],x],{x,0,4},Filling->Axis,Exclusions->None,PlotRange->{0,1},PlotLabel->k],{k,1,4}]

(RefLink[ErlangDistribution, paclet:ref/ErlangDistribution])[k,λ] is the convolution of k (RefLink[ExponentialDistribution, paclet:ref/ExponentialDistribution])[λ] PDFs:

Convolve[PDF[ErlangDistribution[k,λ],x],PDF[ExponentialDistribution[λ],x],x,y]

PDF[ErlangDistribution[k+1,λ],y]

FullSimplify[%%-%]

Table[Plot[PDF[ErlangDistribution[k,1],x],{x,0,8},Filling->Axis,Exclusions->None,PlotRange->{0,1},PlotLabel->k],{k,1,4}]

OpenersExampleSection5(Spacer1)Properties & Relations  (7)

(RefLink[Convolve, paclet:ref/Convolve]) computes an integral over the real line:

Convolve[x^2,E^(-x^2),x,y]

Integrate[x^2 E^(-(y-x)^2),{x,-Infinity,Infinity},Assumptions->Im[y]==0]

Convolution with (RefLink[DiracDelta, paclet:ref/DiracDelta]) gives the function itself:

Convolve[Sin[x],DiracDelta[x],x,y]

Scaling:

Convolve[a r[x],s[x],x,y]

Convolve[r[x],a s[x],x,y]

Commutativity:

f[x_]:=x^2

g[x_]:=E^(-Abs[x])

Convolve[f[x],g[x],x,y]

Convolve[g[x],f[x],x,y]

Distributivity:

Convolve[h[x],i[x]+j[x],x,y]

Convolve[h[x]+i[x],j[x],x,y]

The Laplace transform of a causal convolution is a product of the individual transforms:

f[t_]:=Sin[t]UnitStep[t]

g[t_]:=t UnitStep[t]

Together[LaplaceTransform[Convolve[f[t], g[t], t, y], y, s]]

LaplaceTransform[f[y],  y,s]LaplaceTransform[g[y], y, s]

The Fourier transform of a convolution is related to the product of the individual transforms:

f[t_]:=UnitStep[1-t]UnitStep[t+1]

g[t_]:=2 UnitStep[1/2-t]UnitStep[t+5/2]

Plot[{f[t],g[t]}, {t,-3,3},Exclusions->None,Filling->Axis, PlotRange->All]

FourierTransform[f[x],x,t, FourierParameters -> {1,1}] FourierTransform[g[x],x,t,FourierParameters -> {1,1}]

FourierTransform[Convolve[f[y],g[y],y,x],x,t,FourierParameters->{1,1}]//FullSimplify

FullSimplify[%/%%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Integrate, paclet:ref/Integrate])  ▪  (RefLink[DiscreteConvolve, paclet:ref/DiscreteConvolve])  ▪  (RefLink[MellinConvolve, paclet:ref/MellinConvolve])  ▪  (RefLink[LaplaceTransform, paclet:ref/LaplaceTransform])  ▪  (RefLink[FourierTransform, paclet:ref/FourierTransform])  ▪  (RefLink[DiracDelta, paclet:ref/DiracDelta])  ▪  (RefLink[HeavisideTheta, paclet:ref/HeavisideTheta])  ▪  (RefLink[HeavisidePi, paclet:ref/HeavisidePi])  ▪  (RefLink[HeavisideLambda, paclet:ref/HeavisideLambda])  ▪  (RefLink[GreenFunction, paclet:ref/GreenFunction])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Fourier Analysis, paclet:guide/FourierAnalysis])}, {▪(RefLinkPlain[Integral Transforms, paclet:guide/IntegralTransforms])}, {▪(RefLinkPlain[Generalized Functions, paclet:guide/GeneralizedFunctions])}, {▪(RefLinkPlain[Calculus, paclet:guide/Calculus])}})}})