new function to calculate convolution