Re: Strange behaviour of Fourier[] in Mathematica 7

*To*: mathgroup at smc.vnet.net*Subject*: [mg93962] Re: Strange behaviour of Fourier[] in Mathematica 7*From*: "sjoerd.c.devries at gmail.com" <sjoerd.c.devries at gmail.com>*Date*: Sun, 30 Nov 2008 06:57:24 -0500 (EST)*References*: ggr257$e5r$1@smc.vnet.net

Guy, The same happens on my laptop (win XP). The results in Matheamatica 6.03 and Mathematica 5.2 look OK, in Mathematica 7 the imaginary part of the result appears to have been dropped. In fact the problem can be reduced to this: Fourier[{0.007 + 0.01 I, -0.002 - 0.0024 I}] returns {0.00353553+ 0.00537401 I, 0.00636396+ 0.00876812 I} in Mathematica 6 and {0.00353553, 0.00636396} in Mathematica 7. This looks like a very serious bug indeed! On Nov 29, 11:31 am, "Guy Lamouche" <noem... at noemail.com> wrote: > I came across the following strange behaviour in Mathematica 7 on my system. > > 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 formula > used by Mathematica (as described in the documentation for Fourier), I get a > nice transform with real and imaginary parts (the following is not intended > 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 since > 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