       Re: Using Fourier and InverseFourier instead of Convolve

• To: mathgroup at smc.vnet.net
• Subject: [mg85873] Re: Using Fourier and InverseFourier instead of Convolve
• From: dh <dh at metrohm.ch>
• Date: Tue, 26 Feb 2008 07:46:10 -0500 (EST)
• References: <fpooi0\$1cg\$1@smc.vnet.net>

```
Hi Joshua,

there are 3 problems here, the number of data points after convolution

(can be adjusted in ListConvolve),where the cyclic convolution begins

(can be adjusted in ListConvolve) and the norm of the Foureier Transform

(can be adjusted there). Usualy it is convenient to leave the number of

datra points unchanged. Threfore, the k-parameter of ListConvolve should

be used. Here is an example:

d1 = Table[If[Abs[i] < 3, 1, 0], {i, -5, 5}];

ListLinePlot[{InverseFourier[Fourier[d1] Fourier[d1 ]] Sqrt ,d1}]

ListLinePlot[{ListConvolve[d1, d1, 1], d1}]

as you see the fourier has to be adjusted by Sqrt[n] due to the default

norm. Further, the convolution does not start out with 5. This can be

achieved by setting the k parameter to -1:

ListLinePlot[{ListConvolve[d1, d1, -1], d1}]

Note that the innocent code above crashes my mathematica kernel (version

6.1, does this happen to you too? ) every second time it is executed.

Looks like Wolfram should take note of this.

hope this helps, Daniel

Solomon, Joshua wrote:

> OK, I must admit that I do not understand everything ListConvolve does, but

> I get the convolution I need when I do

> ListConvolve[list1, list2, {1, -1}, 0]

> In particular, the output has the appropriate length:

> Length[list1]+Length[list2]-1.

> Now, I would like to get the identical using Fourier and InverseFourier.

> Is this possible? What is the appropriate syntax?

> j

>

>

```

• Prev by Date: Printing notebook: Header corrupted (v6)
• Next by Date: Re: Using Fourier and InverseFourier instead of Convolve