MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Strange behaviour of Fourier[] in Mathematica 7

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93948] Strange behaviour of Fourier[] in Mathematica 7
  • From: "Guy Lamouche" <noemail at noemail.com>
  • Date: Sat, 29 Nov 2008 04:31:54 -0500 (EST)

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



  • Prev by Date: Re: Floating-Point Computing
  • Next by Date: Re: Re: Floating-Point Computing
  • Previous by thread: RE: Passing default options to nested function call
  • Next by thread: Re: Strange behaviour of Fourier[] in Mathematica 7