I am interested in the convolution of a triangle function of width 2d with a cosine function (it has a useful analogy with a physics problem).
I think I should be able to break the problem down using the following:
- triangle function of width $2d$ is two convolved box-cars of width $d$
- a box-car is two Heaviside functions (one positive, one negative... I think)
- derivative of Heaviside function H: $\partial H = \delta$
- for any convolution $\partial f * g = f*\partial g$
- $\partial (f*g) = \partial f *\partial g$ (I think)
- $\delta*-\delta = 0$ (I think)
The general idea is to convert a triangle function into an equivalent set of convolved Heaviside functions with some offsets, then take the derivative and convolve a bunch of dirac delta functions with the sinusoid.
Therefore, for triangle function $T$, box-cars $B$:
$T(x)*\cos = T(x)*\partial(\sin(x))\\ = (B(x-d/2)*B(x+d/2))*\partial(\sin)\\ = ((H(x-d)-H(x))*(H(x)-H(x+d)))*\partial(\sin)\\ = \partial\big[(H(x-d)-H(x))*(H(x)-H(x+d))\big]*\sin\\ = \big[(\delta(x-d)-\delta(x))*(\delta(x)-\delta(x+d))\big]*\sin\\ = 0*\sin(x)$
Clearly, that is hilariously wrong. This convolution does not generally self-cancel.
I'm sure there is a nice analytical expression here, but I am not sure how to proceed.
PS. For future readers, the flaw is using $\partial (f*g) = \partial f *\partial g$. Differentiation is not distributive across convolution. Error thus propagates from line 4.
Here is a valid derivation. Matches the numerical solution in MATLAB, although off by a constant scaling factor.
Taking a triangle from 0 to 2d.
$T(x)*\cos(x) = T(x)*\partial(\sin(x))\\ = \partial(T)*\sin(x)\\ = (B(d/2)-B(3d/2))*\sin(x)\\ = (B(d/2)-B(3d/2))*\partial(-\cos(x))\\ = \partial \big[ B(d/2)-B(3d/2) \big]*-\cos(x)\\ = \big[ \delta(x) - 2\delta(x-d) + \delta(x-2d) \big]*-\cos(x)\\ = -\cos(x) + 2 \cos(x - d) - \cos(x - 2d)$
Generalising to an input $A k\cos(kx)$ [weird I know, but that's my actual physics equation] I get the result
$T(x)*\cos = \frac{A}{k}\bigg(-\cos(x) + 2 \cos(x - d) - \cos(x - 2d)\bigg)$