DiscreteTransforms
FourierTransform
compute the discrete Fourier transform
InverseFourierTransform
compute the discrete inverse Fourier transform
Calling Sequence
Parameters
Description
Options
Examples
References
FourierTransform(Z, [,options])
FourierTransform(Z1, nelem [,options])
FourierTransform(Zn, dim [,options])
FourierTransform(X, Y [,options])
FourierTransform(X1, Y1, nelem [,options])
FourierTransform(Xn, Yn, dim [,options])
InverseFourierTransform(Z, [,options])
InverseFourierTransform(Z1, nelem [,options])
InverseFourierTransform(Zn, dim [,options])
InverseFourierTransform(X, Y [,options])
InverseFourierTransform(X1, Y1, nelem [,options])
InverseFourierTransform(Xn, Yn, dim [,options])
Z
-
complex data Array, 1-5 dimensional
Z1
complex data Array, 1 dimensional
Zn
complex data Array, 2-5 dimensional
X, Y
real data Arrays, 1-5 dimensional
X1, Y1
real data Arrays, 1 dimensional
Xn, Yn
real data Arrays, 2-5 dimensional
nelem
number of discrete data points to use in the transform
dim
Array dimension to be transformed
options
optional argument of the type option=value, where option is one of algorithm, padding, inplace, workingstorage, and normalization
The FourierTransform and InverseFourierTransform commands compute the forward and inverse Fourier transform of the numerical input data. For the single data Array form, the input data Z is interpreted as a complex Array. For the two data Array form, the inputs X,Y are interpreted as the real and imaginary parts of the data, respectively.
Note: The FourierTransform and InverseFourierTransform commands work strictly in hardware precision, so their accuracy is independent of the setting of Digits. Additionally, in all cases, the input data must either be floating-point numerical data, or must evaluate to floating-point numerical data. Symbolic entries are not allowed.
The definition in use for a 1-D N-point forward transform of the data zj is given by
Zi=1N⁢∑j=1N⁡zj⁢ⅇ−2⁢I⁢π⁢i−1⁢j−1N,i=1..N
And the definition for the inverse transform by
zj=1N⁢∑i=1N⁡Zi⁢ⅇ2⁢I⁢π⁢i−1⁢j−1N,j=1..N
where symmetric normalization by 1N is in use (this can be changed via the normalization option).
If the input data is a one-dimensional Array, then the number of elements in the Array to be used for the transform can be specified as nelem. This allows re-use of the same storage for different sized transforms (and also inplace output with padding - see inplace and padding below).
If the input data is an Array of dimension greater than 1, or a Matrix, then by default a transform is performed with respect to all dimensions of the input for all combinations of the indices. In this case, the data lengths cannot be specified.
For example, calling FourierTransform or InverseFourierTransform with a complex 20x30 Matrix performs a 20 data point transform for each of the 30 columns of the Matrix data, followed by a 30 data point transform for each of the 20 rows of the (already once transformed) Matrix data.
Specification of dim tells FourierTransform or InverseFourierTransform to perform a transform only along that Array dimension, or for the 20x30 Matrix example, specification of dim=1 transforms with respect to the Matrix rows, performing a 20 data point transform for each column of the Matrix, while specification of dim=2 transforms with respect to the Matrix columns, performing a 30 data point transform for each row of the Matrix.
For more information on Fourier transforms in Maple, including a summarized comparison of DiscreteTransforms[FourierTransform], SignalProcessing[FFT], and SignalProcessing[DFT], see Fourier Transforms in Maple.
Optional arguments control the way in which the Fourier or inverse Fourier transform is performed.
algorithm=alg
Where alg can be set to mintime (default), minstorage, or DFT. The mintime algorithm is an efficient implementation of the twiddle factor FFT algorithm from Brigham. The minstorage algorithm is a variant of the same algorithm that has been modified to use as little additional storage as possible. For more information, see FourierTransform/efficiency. The DFT algorithm is simply the O⁡N2 discrete Fourier transform (very slow, and provided primarily for educational purposes).
padding=num
Here num specifies the maximum amount of zero padding that can be used to more efficiently compute the Fourier transform. The mintime and minstorage algorithms are fast Fourier transform algorithms, and as such, are more efficient when the data length is a highly composite number (that is, has many small integer factors). By default, no zero padding is used, so for computations where the data length is actually a large prime, the mintime and minstorage algorithms are as inefficient as the DFT algorithm. It is generally advisable to collect the transform data with a highly composite number of data points, so no padding is needed, and the transform can be computed efficiently. For more information, see FourierTransform/efficiency.
inplace=bool
Here bool can have the value true or false and specifies whether the output overwrites the input. By default this is false. Further, if a single input Array is used, with a float data type (that is, float, float8 or sfloat) then inplace output cannot be used, as the complex result cannot be stored in the input.
Note: It is not generally possible to use padding and inplace output, as the output data length can exceed the size of the input data, so there is insufficient space in the input to store the result. The only exception is when a 1-D transform is being performed, and the specified data length nelem plus the maximal padding will fit in the input Array. In this case the output can be provided inplace.
workingstorage=data
Here data must be a complex valued rectangular Vector or Matrix with between m*n and 2*m*n entries (where m is the number of transforms being computed, and n is the data length of the transform). This storage is then used as working storage, preventing the algorithm from allocating any additional storage. Note that this is not required for the DFT algorithm. The quantity of additional storage required depends upon the data length. If the data length is prime, then the required storage is 2*m*n, but for all other cases, the required storage is m*n.
normalization=symmetric (default), none or full
The process of performing a forward transform followed by an inverse transform, without normalization, introduces a factor of n to the data values. Three normalizations are in common use, including symmetric normalization (the default), where the data is multiplied by 1n in both transform directions. The other two cases correspond to performing no normalization on the forward transform, and 1n normalization on the inverse transform, and the reverse of this. Specification of normalization=none on a transform will prevent normalization, while specification of normalization=full will perform 1n normalization, so by consistent use of this this option between the forward and inverse transformations, one can obtain any of the three normalizations commonly used in practice.
The output from FourierTransform and InverseFourierTransform is in two forms, which are different only if padding is in use or not.
Without padding, the output is simply the single Array (for the single complex input form) or a two element sequence containing the pair of Arrays (for the separated real/imaginary part form) that contain the computed transform of the input data. For inplace operation, these output Array(s) are the same as the input Array(s).
If padding is in use, a list representing the data lengths used for the transform is the first element of the output sequence, followed by the data (1 or 2 Arrays).
Efficiency
The most efficient transform can be obtained when the data length(s) are highly composite, the input data has datatype=complex8, and the computation is being performed inplace. Input data with any other datatype is copied to a complex8 data Array for the computation, then transformed back to the input datatype on output. For more information, see FourierTransform/efficiency.
with⁡DiscreteTransforms:
Digits≔15:
Transform of 1-D complex Vector.
Z≔Vector⁡5,i↦evalf⁡exp⁡I3⋅i,datatype=complex8
Z≔0.944956946314738+0.327194696796152⁢I0.785887260776948+0.618369803069737⁢I0.540302305868140+0.841470984807897⁢I0.235237573302993+0.971937901363312⁢I−0.0957235480143790+0.995407957751765⁢I
Z2≔FourierTransform⁡Z
Z2≔1.07808016683995+1.67901037963378⁢I0.0427237445328346−0.741915464402484⁢I0.236451541664114−0.288930752395548⁢I0.323690442005380−0.0849440827896753⁢I0.432042072728096+0.168409503867555⁢I
InverseFourierTransform⁡Z2,inplace=true:
Z−Z2
0.−1.66533453693773×10−16⁢I1.11022302462516×10−16+1.11022302462516×10−16⁢I0.−1.11022302462516×10−16⁢I2.77555756156289×10−17+0.⁢I8.32667268468867×10−17+1.11022302462516×10−16⁢I
Transform of 2 1-D real Vectors (real and imaginary parts).
X,Y≔Vector⁡5,i↦evalf⁡cos⁡i3,datatype=float8,Vector⁡5,i↦evalf⁡sin⁡i3,datatype=float8
X,Y≔0.9449569463147380.7858872607769480.5403023058681400.235237573302993−0.0957235480143790,0.3271946967961520.6183698030697370.8414709848078970.9719379013633120.995407957751765
X2,Y2≔FourierTransform⁡X,Y
X2,Y2≔1.078080166839950.04272374453283460.2364515416641140.3236904420053800.432042072728096,1.67901037963378−0.741915464402484−0.288930752395548−0.08494408278967530.168409503867555
InverseFourierTransform⁡X2,Y2,inplace=true
0.9449569463147380.7858872607769480.5403023058681400.235237573302993−0.0957235480143791,0.3271946967961520.6183698030697370.8414709848078970.9719379013633120.995407957751765
X−X2,Y−Y2
0.1.11022302462516×10−160.2.77555756156289×10−178.32667268468867×10−17,−1.66533453693773×10−161.11022302462516×10−16−1.11022302462516×10−160.1.11022302462516×10−16
1-D transform with padding.
Z≔Vector⁡60,i↦evalf⁡exp⁡I30⋅i
Z2≔FourierTransform⁡Z,padding=10
A data length of 64, which has 2 as the largest prime factor, was used.
If the input Array is made larger, but the data length is still specified as 60, then in-place output is also possible:
Z≔Vector⁡70,i↦`if`⁡60<i,0,evalf⁡exp⁡I30⋅i
Z2≔FourierTransform⁡Z,60,padding=10,inplace=true
Two-dimensional transform, one dimension at a time, and both at once:
Z≔Matrix⁡3,4,i,j↦i+j2−I⋅i,datatype=complex8
Z≔4.−I9.−I16.−I25.−I9.−2.⁢I16.−2.⁢I25.−2.⁢I36.−2.⁢I16.−3.⁢I25.−3.⁢I36.−3.⁢I49.−3.⁢I
Transform with respect to rows then columns.
Z2≔FourierTransform⁡Z,1
Z2≔16.7431578064991−3.46410161513775⁢I28.8675134594813−3.46410161513775⁢I44.4559707276012−3.46410161513775⁢I63.5085296108588−3.46410161513775⁢I−4.40747728811182+4.36602540378444⁢I−6.13952809568070+5.36602540378444⁢I−7.87157890324957+6.36602540378444⁢I−9.60362971081845+7.36602540378444⁢I−5.40747728811182−2.63397459621556⁢I−7.13952809568070−3.63397459621556⁢I−8.87157890324957−4.63397459621556⁢I−10.6036297108184−5.63397459621556⁢I
FourierTransform⁡Z2,2,inplace=true
76.7875858022202−6.92820323027551⁢I−13.8564064605510+17.3205080756888⁢I−15.5884572681199+0.⁢I−13.8564064605510−17.3205080756888⁢I−14.0111069989303+11.7320508075689⁢I0.732050807568877−2.73205080756888⁢I1.73205080756888−0.999999999999999⁢I2.73205080756888+0.732050807568878⁢I−16.0111069989303−8.26794919243112⁢I2.73205080756888−0.732050807568877⁢I1.73205080756888+I0.732050807568878+2.73205080756888⁢I
Transform both at once (inplace):
FourierTransform⁡Z,inplace=true
76.7875858022202−6.92820323027551⁢I−13.8564064605510+17.3205080756888⁢I−15.5884572681199+0.⁢I−13.8564064605510−17.3205080756888⁢I−14.0111069989303+11.7320508075689⁢I0.732050807568877−2.73205080756888⁢I1.73205080756888−I2.73205080756888+0.732050807568877⁢I−16.0111069989303−8.26794919243112⁢I2.73205080756888−0.732050807568877⁢I1.73205080756888+I0.732050807568877+2.73205080756888⁢I
0.+0.⁢I1.77635683940025×10−15+0.⁢I1.77635683940025×10−15+0.⁢I1.77635683940025×10−15+0.⁢I1.77635683940025×10−15+0.⁢I1.11022302462516×10−16+8.88178419700125×10−16⁢I−4.44089209850063×10−16−7.77156117237610×10−16⁢I4.44089209850063×10−16−3.33066907387547×10−16⁢I0.+0.⁢I−8.88178419700125×10−16−7.77156117237610×10−16⁢I1.33226762955019×10−15−1.11022302462516×10−16⁢I−3.33066907387547×10−16+8.88178419700125×10−16⁢I
Brigham, E.O. The Fast Fourier Transform. New Jersey: Prentice-Hall Inc., 1974.
See Also
fourier_in_maple
FourierTransform/efficiency
SignalProcessing[FFT]
Download Help Document