# Convolution in Python

I have an integral of a convolution between two functions. How can I calculate this in Python? It is a continuum convolution.

## 2 Answers

I think that you can use convolve() from scipy.signal. As mentioned in a previous question, you can take advantage that the Fourier Transform of a convolution represents a product.

• Do you have any material that explain this things better? I will be gratefull! Btw, thanks for your help! :) – Brenda Pinheiro Apr 2 '20 at 21:44
• @BrendaPinheiro, sadly I don't. But you might want to check Wikipedia's article: en.wikipedia.org/wiki/Convolution_theorem – nicoguaro Apr 2 '20 at 21:46
• Thanks you! :)) – Brenda Pinheiro Apr 3 '20 at 1:10

That depends on what kind of integral transform you are looking at.

Your comments suggest that you are looking at a Fourier transform specifically, so I would recommend the FFT implementation of NumPy. Using this approach you can also tackle Laplace transforms.

For the most general case you will have to evaluate your convolution using a brute force numerical quadrature appropriate for the type of integral you are trying to evaluate.