FourierTransform - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Calculus : Transforms : FourierTransform

DiscreteTransforms

 FourierTransform
 compute the discrete Fourier transform
 InverseFourierTransform
 compute the discrete inverse Fourier transform

 Calling Sequence 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])

Parameters

 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

Description

 • 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 ${z}_{j}$ is given by

${Z}_{i}=\sqrt{\frac{1}{N}}\left[{\sum }_{j=1}^{N}{z}_{j}{ⅇ}^{\frac{-2I\mathrm{\pi }\left(i-1\right)\left(j-1\right)}{N}}\right],i=1..N$

 And the definition for the inverse transform by

${z}_{j}=\sqrt{\frac{1}{N}}\left[{\sum }_{i=1}^{N}{Z}_{i}{ⅇ}^{\frac{2I\mathrm{\pi }\left(i-1\right)\left(j-1\right)}{N}}\right],j=1..N$

 where symmetric normalization by $\sqrt{\frac{1}{N}}$ 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.

Options

 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 $\mathrm{O}\left({N}^{2}\right)$ 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, $\mathrm{float}$, ${\mathrm{float}}_{8}$ or $\mathrm{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 $\frac{1}{\sqrt{n}}$ in both transform directions. The other two cases correspond to performing no normalization on the forward transform, and $\frac{1}{n}$ 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 $\frac{1}{n}$ 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 $\mathrm{datatype}={\mathrm{complex}}_{8}$, and the computation is being performed inplace. Input data with any other datatype is copied to a ${\mathrm{complex}}_{8}$ data Array for the computation, then transformed back to the input datatype on output. For more information, see FourierTransform/efficiency.

Examples

 > $\mathrm{with}\left(\mathrm{DiscreteTransforms}\right):$
 > $\mathrm{Digits}≔15:$

Transform of 1-D complex Vector.

 > $Z≔\mathrm{Vector}\left(5,i↦\mathrm{evalf}\left(\mathrm{exp}\left(\frac{I}{3}\cdot i\right)\right),\mathrm{datatype}=\mathrm{complex}\left[8\right]\right)$
 ${Z}{≔}\left[\begin{array}{c}{0.944956946314738}{+}{0.327194696796152}{}{I}\\ {0.785887260776948}{+}{0.618369803069737}{}{I}\\ {0.540302305868140}{+}{0.841470984807897}{}{I}\\ {0.235237573302993}{+}{0.971937901363312}{}{I}\\ {-0.0957235480143789}{+}{0.995407957751765}{}{I}\end{array}\right]$ (1)
 > $\mathrm{Z2}≔\mathrm{FourierTransform}\left(Z\right)$
 ${\mathrm{Z2}}{≔}\left[\begin{array}{c}{1.07808016683995}{+}{1.67901037963378}{}{I}\\ {0.0427237445328347}{-}{0.741915464402484}{}{I}\\ {0.236451541664114}{-}{0.288930752395547}{}{I}\\ {0.323690442005380}{-}{0.0849440827896754}{}{I}\\ {0.432042072728096}{+}{0.168409503867555}{}{I}\end{array}\right]$ (2)
 > $\mathrm{InverseFourierTransform}\left(\mathrm{Z2},\mathrm{inplace}=\mathrm{true}\right):$
 > $Z-\mathrm{Z2}$
 $\left[\begin{array}{c}{0.}{+}{5.55111512312578}{×}{{10}}^{{-17}}{}{I}\\ {1.11022302462516}{×}{{10}}^{{-16}}{+}{1.11022302462516}{×}{{10}}^{{-16}}{}{I}\\ {1.11022302462516}{×}{{10}}^{{-16}}{+}{0.}{}{I}\\ {8.32667268468867}{×}{{10}}^{{-17}}{+}{0.}{}{I}\\ {-2.77555756156289}{×}{{10}}^{{-17}}{+}{1.11022302462516}{×}{{10}}^{{-16}}{}{I}\end{array}\right]$ (3)

Transform of 2 1-D real Vectors (real and imaginary parts).

 > $X,Y≔\mathrm{Vector}\left(5,i↦\mathrm{evalf}\left(\mathrm{cos}\left(\frac{i}{3}\right)\right),\mathrm{datatype}=\mathrm{float}\left[8\right]\right),\mathrm{Vector}\left(5,i↦\mathrm{evalf}\left(\mathrm{sin}\left(\frac{i}{3}\right)\right),\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${X}{,}{Y}{≔}\left[\begin{array}{c}{0.944956946314738}\\ {0.785887260776948}\\ {0.540302305868140}\\ {0.235237573302993}\\ {-0.0957235480143789}\end{array}\right]{,}\left[\begin{array}{c}{0.327194696796152}\\ {0.618369803069737}\\ {0.841470984807897}\\ {0.971937901363312}\\ {0.995407957751765}\end{array}\right]$ (4)
 > $\mathrm{X2},\mathrm{Y2}≔\mathrm{FourierTransform}\left(X,Y\right)$
 ${\mathrm{X2}}{,}{\mathrm{Y2}}{≔}\left[\begin{array}{c}{1.07808016683995}\\ {0.0427237445328347}\\ {0.236451541664114}\\ {0.323690442005380}\\ {0.432042072728096}\end{array}\right]{,}\left[\begin{array}{c}{1.67901037963378}\\ {-0.741915464402484}\\ {-0.288930752395547}\\ {-0.0849440827896754}\\ {0.168409503867555}\end{array}\right]$ (5)
 > $\mathrm{InverseFourierTransform}\left(\mathrm{X2},\mathrm{Y2},\mathrm{inplace}=\mathrm{true}\right)$
 $\left[\begin{array}{c}{0.944956946314738}\\ {0.785887260776948}\\ {0.540302305868140}\\ {0.235237573302993}\\ {-0.0957235480143789}\end{array}\right]{,}\left[\begin{array}{c}{0.327194696796152}\\ {0.618369803069737}\\ {0.841470984807897}\\ {0.971937901363312}\\ {0.995407957751765}\end{array}\right]$ (6)
 > $X-\mathrm{X2},Y-\mathrm{Y2}$
 $\left[\begin{array}{c}{0.}\\ {1.11022302462516}{×}{{10}}^{{-16}}\\ {1.11022302462516}{×}{{10}}^{{-16}}\\ {8.32667268468867}{×}{{10}}^{{-17}}\\ {-2.77555756156289}{×}{{10}}^{{-17}}\end{array}\right]{,}\left[\begin{array}{c}{5.55111512312578}{×}{{10}}^{{-17}}\\ {1.11022302462516}{×}{{10}}^{{-16}}\\ {0.}\\ {0.}\\ {1.11022302462516}{×}{{10}}^{{-16}}\end{array}\right]$ (7)

1-D transform with padding.

 > $Z≔\mathrm{Vector}\left(60,i↦\mathrm{evalf}\left(\mathrm{exp}\left(\frac{I}{30}\cdot i\right)\right)\right)$
 ${Z}{≔}\begin{array}{c}\left[\begin{array}{c}{0.999444495882868}{+}{0.0333271608367536}{}{I}\\ {0.997778600701122}{+}{0.0666172949233930}{}{I}\\ {0.995004165278026}{+}{0.0998334166468282}{}{I}\\ {0.991124272034179}{+}{0.132938622622314}{}{I}\\ {0.986143231562925}{+}{0.165896132693415}{}{I}\\ {0.980066577841242}{+}{0.198669330795061}{}{I}\\ {0.972901062081451}{+}{0.231221805634298}{}{I}\\ {0.964654645230564}{+}{0.263517391143535}{}{I}\\ {0.955336489125606}{+}{0.295520206661340}{}{I}\\ {0.944956946314738}{+}{0.327194696796152}{}{I}\\ {⋮}\end{array}\right]\\ \hfill {\text{60 element Vector[column]}}\end{array}$ (8)
 > $\mathrm{Z2}≔\mathrm{FourierTransform}\left(Z,\mathrm{padding}=10\right)$
 ${\mathrm{Z2}}{≔}\left[{64}\right]{,}\begin{array}{c}\left[\begin{array}{c}{3.32104043919193}{+}{5.36688999947069}{}{I}\\ {-1.09039750409989}{-}{3.41938842912922}{}{I}\\ {-0.0955161081087380}{-}{1.50798291900311}{}{I}\\ {0.173877352703572}{-}{0.943837779912460}{}{I}\\ {0.283402274079147}{-}{0.621849136821280}{}{I}\\ {0.314994689241208}{-}{0.395107109509414}{}{I}\\ {0.297393075215391}{-}{0.227162800137781}{}{I}\\ {0.248100230552716}{-}{0.106909371188219}{}{I}\\ {0.181518777652859}{-}{0.0295599038566358}{}{I}\\ {0.110463576601868}{+}{0.00930153242857243}{}{I}\\ {⋮}\end{array}\right]\\ \hfill {\text{64 element Vector[column]}}\end{array}$ (9)

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≔\mathrm{Vector}\left(70,i↦\mathrm{if}\left(60
 ${Z}{≔}\begin{array}{c}\left[\begin{array}{c}{0.999444495882868}{+}{0.0333271608367536}{}{I}\\ {0.997778600701122}{+}{0.0666172949233930}{}{I}\\ {0.995004165278026}{+}{0.0998334166468282}{}{I}\\ {0.991124272034179}{+}{0.132938622622314}{}{I}\\ {0.986143231562925}{+}{0.165896132693415}{}{I}\\ {0.980066577841242}{+}{0.198669330795061}{}{I}\\ {0.972901062081451}{+}{0.231221805634298}{}{I}\\ {0.964654645230564}{+}{0.263517391143535}{}{I}\\ {0.955336489125606}{+}{0.295520206661340}{}{I}\\ {0.944956946314738}{+}{0.327194696796152}{}{I}\\ {⋮}\end{array}\right]\\ \hfill {\text{70 element Vector[column]}}\end{array}$ (10)
 > $\mathrm{Z2}≔\mathrm{FourierTransform}\left(Z,60,\mathrm{padding}=10,\mathrm{inplace}=\mathrm{true}\right)$
 ${\mathrm{Z2}}{≔}\left[{64}\right]{,}\begin{array}{c}\left[\begin{array}{c}{3.32104043919193215}{+}{5.36688999947068623}{}{I}\\ {-1.09039750409989478}{-}{3.41938842912921626}{}{I}\\ {-0.0955161081087380348}{-}{1.50798291900311021}{}{I}\\ {0.173877352703571630}{-}{0.943837779912460428}{}{I}\\ {0.283402274079147254}{-}{0.621849136821279846}{}{I}\\ {0.314994689241208103}{-}{0.395107109509413801}{}{I}\\ {0.297393075215390712}{-}{0.227162800137781118}{}{I}\\ {0.248100230552715822}{-}{0.106909371188218888}{}{I}\\ {0.181518777652858870}{-}{0.0295599038566357816}{}{I}\\ {0.110463576601867980}{+}{0.00930153242857242879}{}{I}\\ {⋮}\end{array}\right]\\ \hfill {\text{70 element Vector[column]}}\end{array}$ (11)

Two-dimensional transform, one dimension at a time, and both at once:

 > $Z≔\mathrm{Matrix}\left(3,4,\left(i,j\right)↦{\left(i+j\right)}^{2}-I\cdot i,\mathrm{datatype}=\mathrm{complex}\left[8\right]\right)$
 ${Z}{≔}\left[\begin{array}{cccc}{4.}{-}{I}& {9.}{-}{I}& {16.}{-}{I}& {25.}{-}{I}\\ {9.}{-}{2.}{}{I}& {16.}{-}{2.}{}{I}& {25.}{-}{2.}{}{I}& {36.}{-}{2.}{}{I}\\ {16.}{-}{3.}{}{I}& {25.}{-}{3.}{}{I}& {36.}{-}{3.}{}{I}& {49.}{-}{3.}{}{I}\end{array}\right]$ (12)

Transform with respect to rows then columns.

 > $\mathrm{Z2}≔\mathrm{FourierTransform}\left(Z,1\right)$
 ${\mathrm{Z2}}{≔}\left[\begin{array}{cccc}{16.7431578064991}{-}{3.46410161513775}{}{I}& {28.8675134594813}{-}{3.46410161513775}{}{I}& {44.4559707276012}{-}{3.46410161513775}{}{I}& {63.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}\end{array}\right]$ (13)
 > $\mathrm{FourierTransform}\left(\mathrm{Z2},2,\mathrm{inplace}=\mathrm{true}\right)$
 $\left[\begin{array}{cccc}{76.7875858022202}{-}{6.92820323027551}{}{I}& {-13.8564064605510}{+}{17.3205080756888}{}{I}& {-15.5884572681199}{+}{0.}{}{I}& {-13.8564064605510}{-}{17.3205080756888}{}{I}\\ {-14.0111069989303}{+}{11.7320508075689}{}{I}& {0.732050807568877}{-}{2.73205080756888}{}{I}& {1.73205080756888}{-}{0.999999999999999}{}{I}& {2.73205080756888}{+}{0.732050807568878}{}{I}\\ {-16.0111069989303}{-}{8.26794919243112}{}{I}& {2.73205080756888}{-}{0.732050807568877}{}{I}& {1.73205080756888}{+}{I}& {0.732050807568878}{+}{2.73205080756888}{}{I}\end{array}\right]$ (14)

Transform both at once (inplace):

 > $\mathrm{FourierTransform}\left(Z,\mathrm{inplace}=\mathrm{true}\right)$
 $\left[\begin{array}{cccc}{76.7875858022202}{-}{6.92820323027551}{}{I}& {-13.8564064605510}{+}{17.3205080756888}{}{I}& {-15.5884572681199}{+}{0.}{}{I}& {-13.8564064605510}{-}{17.3205080756888}{}{I}\\ {-14.0111069989303}{+}{11.7320508075689}{}{I}& {0.732050807568877}{-}{2.73205080756888}{}{I}& {1.73205080756888}{-}{I}& {2.73205080756888}{+}{0.732050807568877}{}{I}\\ {-16.0111069989303}{-}{8.26794919243112}{}{I}& {2.73205080756888}{-}{0.732050807568877}{}{I}& {1.73205080756888}{+}{I}& {0.732050807568877}{+}{2.73205080756888}{}{I}\end{array}\right]$ (15)
 > $Z-\mathrm{Z2}$
 $\left[\begin{array}{cccc}{0.}{+}{0.}{}{I}& {1.77635683940025}{×}{{10}}^{{-15}}{+}{0.}{}{I}& {1.77635683940025}{×}{{10}}^{{-15}}{+}{0.}{}{I}& {1.77635683940025}{×}{{10}}^{{-15}}{+}{0.}{}{I}\\ {1.77635683940025}{×}{{10}}^{{-15}}{+}{0.}{}{I}& {1.11022302462516}{×}{{10}}^{{-16}}{+}{8.88178419700125}{×}{{10}}^{{-16}}{}{I}& {-4.44089209850063}{×}{{10}}^{{-16}}{-}{7.77156117237610}{×}{{10}}^{{-16}}{}{I}& {4.44089209850063}{×}{{10}}^{{-16}}{-}{3.33066907387547}{×}{{10}}^{{-16}}{}{I}\\ {0.}{+}{0.}{}{I}& {-8.88178419700125}{×}{{10}}^{{-16}}{-}{7.77156117237610}{×}{{10}}^{{-16}}{}{I}& {1.33226762955019}{×}{{10}}^{{-15}}{-}{1.11022302462516}{×}{{10}}^{{-16}}{}{I}& {-3.33066907387547}{×}{{10}}^{{-16}}{+}{8.88178419700125}{×}{{10}}^{{-16}}{}{I}\end{array}\right]$ (16)

References

 Brigham, E.O. The Fast Fourier Transform. New Jersey: Prentice-Hall Inc., 1974.

 See Also