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.
-
$\begingroup$ Do you have any material that explain this things better? I will be gratefull! Btw, thanks for your help! :) $\endgroup$ Apr 2, 2020 at 21:44
-
$\begingroup$ @BrendaPinheiro, sadly I don't. But you might want to check Wikipedia's article: en.wikipedia.org/wiki/Convolution_theorem $\endgroup$– nicoguaro ♦Apr 2, 2020 at 21:46
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.