### 5.23.3 Convolution of two signals : convolution

convolution takes two arguments, a real vector v of length n and a real vector w of length m , and returns their convolution z=v∗w which is the vector of length N=n+m−1 defined as :

zk= |
k
∑
i=0
| vi wk−i, k=0,1,…,N−1,

such that vj=0 for j≥ n and wj=0 for j≥ m . For example, input :

convolution([1,2,3],[1,-1,1,-1])

Output :

[1.0,1.0,2.0,-2.0,1.0,-3.0]