Why idft(dft(a) * dft(b)) not equal to convolve(a, b)? I'm a little confused... I always thought the DFT of a convolution was equal to a product of DFTs, but when I tried this in Python:

from scipy import *

a = [1+0j, 2+0j]
b = [4+0j, 5+0j]

print list(ifft(fft(a) * fft(b)))
print list(convolve(a, b))


I got back:

[(14+0j), (13+0j)]
[(4+0j), (13+0j), (10+0j)]


Why are they not the same thing?
ifft(fft(a) * fft(b)) performs a cyclic convolution, convolve apparently zero-pads the inputs. If you pad both arrays with zeros, the result should be the same:

a = [0,0,0,1+0j, 2+0j,0,0,0]
b = [0,0,0,4+0j, 5+0j,0,0,0]

print list(ifft(fft(a) * fft(b)))
print list(convolve(a, b))