Re: Fourier? (Q)
- To: mathgroup at smc.vnet.net
- Subject: [mg3614] Re: Fourier? (Q)
- From: ianc (Ian Collier)
- Date: Thu, 28 Mar 1996 00:10:56 -0500
- Organization: Wolfram Research, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
In article <4j7hq8$af4 at dragonfly.wolfram.com>, mrsma at uno.edu wrote: > greetings: > > when i tried to go through the Fourier examples as per pgs 679-681 in the Mma bible; > > Mma kindly returned the following: > In[65]:= > ?Fourier > Fourier[list] finds the discrete Fourier transform of a list > of complex numbers. > In[66]:= > data={1,1,1,1,-1,-1,-1,-1} > Out[66]= > {1, 1, 1, 1, -1, -1, -1, -1} > In[67]:= > Fourier[data] > Out[67]= > Fourier[{1, 1, 1, 1, -1, -1, -1, -1}] > > i then tried the example on a PowerMac, NeXT, RS6000 and got the same reply. > > what am i missing here? > > sincerely, > m. r. The command Fourier in Version 2.2 has slightly different behavior than it did in Version 2.1. If all the elements in a list are exact numbers, then Fourier will return the input unchanged. However, if even one element is inexact, then the transform will be calculated. It will also allow numeric quantities that are exact numbers if N will turn them into inexact numbers; however, it will still need at least one element to be inexact in order to recognize the input as inexact. This is different than in Versions 2.0 and 2.1, and hence some of the examples on page 680 of the Mathematica book (that shipped with Version 2.2) will not work as given. In[1]:= Fourier[{-1, -1, 1, 1, 1}] Out[1]= Fourier[{-1, -1, 1, 1, 1}] In[2]:= Fourier[{-1, -1, 1, 1, 1.}] Out[2]= {0.447214 + 0. I, -1.17082 - 0.850651 I, -0.17082 - 0.525731 I, > -0.17082 + 0.525731 I, -1.17082 + 0.850651 I} In[3]:= Fourier[{Cos[Pi], Cos[2 Pi / 5], 1, 1}] 2 Pi Out[3]= Fourier[{-1, Cos[----], 1, 1}] 5 In[4]:= Fourier[{Cos[Pi], Cos[2 Pi / 5], 1, 1.}] Out[4]= {0.654508 + 0. I, -1. - 0.345492 I, -0.654508 + 0. I, > -1. + 0.345492 I} This and many other frequently asked questions about Mathematica, is addressed in the Technical Support FAQ area of the Wolfram Research Web pages <http://www.wolfram.com/techsupport/>. Here is the entry for Fourier: ----------------------------------------------------------------- Why does Fourier return what I typed in? This change is mentioned in the most recent documentation, but was inadvertently omitted from the documentation that was included with the earliest releases of Version 2.2. In the design of Mathematica, Fourier is currently considered a symbolic function rather than a numerical function, and as such it is inconsistent for Fourier to artificially lower the precision of exact arguments. The same is true of functions like Sin and Cos, which are also considered symbolic functions. Sin[3/2], for example, does not convert the exact number 3/2 to the inexact number 1.5 and proceed to return an inexact result. The exact expression Sin[3/2] is useful by itself, and it is considered undesirable to convert it to something inexact. The same design principle has been used for Fourier. The behavior of Fourier is simply a matter of choosing whether the design should be based on the abstract mathematical fact that Fourier is meaningful (if perhaps a bit impractical) for exact input, or on the practical fact that the algorithm and the most common applications are strictly numerical. You can restore Version 2.1 behavior by adding the following rule for Fourier. In[5]:= Unprotect[Fourier] In[6]:= Fourier[e_] := With[{ne = N[e]}, Fourier[ne] /; Precision[ne] =!= Infinity] /; Precision[e] === Infinity In[7]:= Protect[Fourier] The change in Fourier was debated in the technical group, and the decision was made to make the change. We have, however, been keeping track of comments from users, and it is entirely possible that this change will be reversed or otherwise modified for some future release of Mathematica. ------------------------------------------------------------------- I hope this helps. --Ian ----------------------------------------------------------- Ian Collier Wolfram Research, Inc. ----------------------------------------------------------- tel:(217) 398-0700 fax:(217) 398-0747 ianc at wolfram.com Wolfram Research Home Page: http://www.wolfram.com/ ----------------------------------------------------------- ==== [MESSAGE SEPARATOR] ====