Re: Strange behaviour of Fourier[] in Mathematica 7
- To: mathgroup at smc.vnet.net
- Subject: [mg93974] Re: Strange behaviour of Fourier[] in Mathematica 7
- From: WetBlanket <Wyvern864 at gmail.com>
- Date: Sun, 30 Nov 2008 06:59:39 -0500 (EST)
- References: <ggr257$e5r$1@smc.vnet.net>
On Nov 29, 3:31 am, "Guy Lamouche" <noem... at noemail.com> wrote: > I came across the following strange behaviour in Mathematica 7 on my syst= em. > > Here is some data generated in an intermediate calculation: > > data = {-0.00023798861821554878` + 0.` I, > 0.0006139487084761968` - > 0.001435108611558083` I, -0.001710424871758314` + > 0.0069296921181465935` I, > 0.0019942263545704086` - 0.021565769535630507` I, > 0.002517554651534451` + > 0.04381651818448262` I, -0.01220847735732839` - > 0.05813547502399065` I, > 0.018746602690952168` + > 0.050324001393803136` I, -0.01572173179907872` - > 0.028359695723765642` I, > 0.007974058406218107` + > 0.010364643233016675` I, -0.0025342667815659334` - > 0.0024424248976939247` I, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, > 0.`, 0.`, 0.`} > > If I compute the discrete Fourier transform by applying directly the form= ula > used by Mathematica (as described in the documentation for Fourier), I ge= t a > nice transform with real and imaginary parts (the following is not intend= ed > to be read, but pasted in Mathematica front-end): > > n = Length[data]; > u[s_] = 1/Sqrt[n] \!\( > \*UnderoverscriptBox[\(\[Sum]\), \(r = > 1\), \(n\)]\(data[\([\)\(r\)\(]\)]\ Exp[ > I\ 2. \[Pi] \((r - 1)\) \((s - 1)\)/n]\)\); > dataTF1 = Table[u[i], {i, 1, n}]; > ListPlot[{dataTF1 // Re, dataTF1 // Im}, PlotRange -> All, > PlotStyle -> {Blue, Red}] > > If I use Fourier[], the imaginary part is put to zero!!! > > dataTF2 = Fourier[data]; > ListPlot[{dataTF2 // Re, dataTF2 // Im}, PlotRange -> All, > PlotStyle -> {Blue, Red}] > > This behaviour occurs on my system only for some data like the one above, > but it does occur. There is no problem with 6.0.3 on another computer sin= ce > the result is the same for both calculations above. > > I would like to know if this happens also on other's computer with > Mathematica 7? I am using the windows version ("7.0 for Microsoft Windows > (32-bit) (November 10, 2008)") under Vista Business SP1. > > Thanks in advance. > > Guy Lamouche I am running V7 on a Dell Laptop (XPS M2010) under Windows XPS and I get the same results with both methods. I copied the code directly out of your e-mail. Gary