This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Fourier Series Package

The Mathematica kernel provides the functions FourierTransform and InverseFourierTransform for computing the symbolic Fourier exponential transform and inverse transform. It also provides the functions FourierSinTransform, InverseFourierSinTransform, FourierCosTransform, and InverseFourierCosTransform for computing the symbolic Fourier sine and cosine transforms and their inverses. This package provides functions giving numerical approximations to these Fourier transforms. It also provides functions for Fourier series, Fourier coefficients, discrete-time Fourier transforms, and their numerical counterparts. The numerical approximations use Mathematica's numerical integration and summation directly without first trying for an exact solution.
NFourierTransform[expr,t,]find a numerical approximation to the Fourier transform of expr evaluated at the numerical value , where expr is treated as a function of t
NInverseFourierTransform[expr,,t]find a numerical approximation to the inverse Fourier transform of expr evaluated at the numerical value t, where expr is treated as a function of
NFourierSinTransform[expr,t,]find a numerical approximation to the Fourier sine transform of expr evaluated at the numerical value , where expr is treated as a function of t
NInverseFourierSinTransform[expr,,t]find a numerical approximation to the inverse Fourier sine transform of expr evaluated at the numerical value t, where expr is treated as a function of
NFourierCosTransform[expr,t,]find a numerical approximation to the Fourier cosine transform of expr evaluated at the numerical value , where expr is treated as a function of t
NInverseFourierCosTransform[expr,,t]find a numerical approximation to the inverse Fourier cosine transform of expr evaluated at the numerical value t, where expr is treated as a function of

Finding numerical approximations to Fourier transforms.

This loads the package.
In[1]:=
Click for copyable input
This gives a numerical approximation to the Fourier transform of exp (-t2)/ (1+t) with respect to at =1.
In[2]:=
Click for copyable input
Out[2]=
In addition to supporting the NIntegrate options, the numerical Fourier transform functions support the option FourierParameters. This option allows you to choose among the various conventions used for defining Fourier transforms.
case value Fourier transform and inverse
Mathematica default {0, 1}
general case {a, b}

Effect of FourierParameters setting on Fourier transform.

setting Fourier sine transform inverse Fourier sine transform
{0, 1}
{a, b}

Effect of FourierParameters setting on Fourier sine transform.

setting Fourier cosine transform inverse Fourier cosine transform
{0, 1}
{a, b}

Effect of FourierParameters setting on Fourier cosine transform.

The Fourier transform is commonly used to transform a problem from the continuous "time domain" into the continuous "frequency domain." The Fourier transform may be viewed as the continuous analog of the Fourier series decomposition, which expresses a periodic function as a superposition of exponential or trigonometric functions. Fourier exponential and trigonometric series decompositions may be computed using the functions FourierSeries and FourierTrigSeries. The coefficients of the exponential series are found using FourierCoefficient and the coefficients of the trigonometric series are found using FourierSinCoefficient and FourierCosCoefficient. If the option setting FourierParameters -> {a, b} is specified, the continuous function of t is treated as having a period of 1/b, instead of the default period of 1.
FourierCoefficient[expr,t,n]give the nth coefficient in the exponential series expansion of the periodic function of t equal to expr on the interval to
FourierSinCoefficient[expr,t,n]give the nth coefficient in the sine series expansion
FourierCosCoefficient[expr,t,n]give the nth coefficient in the cosine series expansion
FourierSeries[expr,t,k]give the exponential series expansion to order k of the periodic function of t equal to expr on the interval to
FourierTrigSeries[expr,t,k]give the trigonometric series expansion to order k

Computing Fourier coefficients and series.

Here is a plot of the difference between t and the integer closest to t. It is a periodic function with fundamental interval from to .
In[3]:=
Click for copyable input
Out[3]=
This gives a piece of the Fourier trigonometric series of the difference function. The difference function is odd so its trigonometric series contains only sines.
In[4]:=
Click for copyable input
Out[4]=
The plot of the truncated series is similar to that of the function.
In[5]:=
Click for copyable input
Out[5]=
Here are the two plots on the same axes.
In[6]:=
Click for copyable input
Out[6]=
setting Fourier coefficient
{0, 1}
{a, b}

Effect of FourierParameters setting on Fourier exponential coefficients.

setting Fourier series
{0, 1} Fn e-2int
{a, b} b (1+a)/2Fn e-2ibnt

Effect of FourierParameters setting on Fourier exponential series.

setting c0 cn
{0, 1}
{a, b}

Effect of FourierParameters setting on Fourier cosine coefficients.

setting dn
{0, 1}
{a, b}

Effect of FourierParameters setting on Fourier sine coefficients.

setting Fourier trigonometric series
{0, 1} c0+cncos (2nt)+dnsin (2nt)
{a, b} b (1+a)/2 (c0+cncos (2bnt)+dnsin (2bnt))

Effect of FourierParameters setting on Fourier trigonometric series.

In certain circumstances you will not want exact or symbolic coefficients, but numerical approximations to the coefficients. In these cases you can use the numerical versions of the Fourier series functions. The numerical approximation functions accept the FourierParameters option, allowing you to specify the period.
NFourierCoefficient[expr,t,n]find a numerical approximation to the nth coefficient in the exponential series expansion
NFourierSinCoefficient[expr,t,n]find a numerical approximation to the nth coefficient in the sine series expansion
NFourierCosCoefficient[expr,t,n]find a numerical approximation to the nth coefficient in the cosine series expansion
NFourierSeries[expr,t,k]find the exponential series expansion to order k using numerical approximations for the coefficients
NFourierTrigSeries[expr,t,k]find the trigonometric series expansion to order k using numerical approximations for the coefficients

Finding approximate numerical values for Fourier coefficients and series.

Here is a piece of the trigonometric series of a function that looks like on the interval from to . The function elsewhere is obtained by repeating this with period 1.
In[7]:=
Click for copyable input
Out[7]=
Here is a plot of the trigonometric polynomial over three periods.
In[8]:=
Click for copyable input
Out[8]=
The function FourierCoefficient, giving the coefficients of the Fourier exponential series, can be thought of as a transform from the continuous time domain into the discrete frequency domain. Likewise, the (infinite sum) Fourier exponential series can be thought of as an inverse transform from the discrete frequency domain into the continuous time domain. This transform pair is given by FourierCoefficient and InverseFourierCoefficient, and the numerical counterparts are given by NFourierCoefficient and NInverseFourierCoefficient. If the option setting FourierParameters -> {a, b} is specified, the period of the original function is taken to be 1/b, instead of the default period of 1.
FourierCoefficient[expr,t,n]give Fn, a function of integer n and the nth coefficient in the exponential series expansion of the periodic function f(t), equal to expr on the interval to
InverseFourierCoefficient[expr,n,t]give f(t), a periodic function of t, represented by the Fourier exponential series coefficients expr, where expr is treated as a function of integer n
NFourierCoefficient[expr,t,n]find a numerical approximation to the function Fn
NInverseFourierCoefficient[expr,n,t]find a numerical approximation to the function f(t)

Continuous-time and discrete-frequency transform pairs: exact and numerical approximations.

Here is a plot of a periodic function of t, with a period of .
In[9]:=
Click for copyable input
Out[9]=
You can use the FourierParameters option to specify the period of the function.
In[10]:=
Click for copyable input
Out[10]=
The inverse of the Fourier coefficients gives the original periodic function.
In[11]:=
Click for copyable input
Out[11]=
setting Fourier coefficient inverse Fourier coefficient
{0, 1} Fn e-2int
{a, b} b (1+a)/2Fn e-2ibnt

Effect of FourierParameters setting on Fourier coefficient.

The Fourier transform from the discrete time domain into the continuous frequency domain is usually termed the discrete-time Fourier transform, or DTFourierTransform. The inverse transform from the continuous frequency domain into the discrete time domain is given by InverseDTFourierTransform. Just as the Z transform is the discrete analog of the Laplace transform, the discrete-time Fourier transform is the discrete analog of the continuous-time Fourier transform. If the option setting FourierParameters -> {a, b} is specified, the period of the discrete-time Fourier transform is taken to be 1/b, instead of the default period of 1.
DTFourierTransform[expr,n,omega]give F(), a periodic function of , equal to the Fourier sum of expr, where expr is treated as a function of integer n
InverseDTFourierTransform[expr,omega,n]give fn, a function of integer n and the inverse Fourier sum of the periodic function F(), where F() is equal to expr on the interval to
NDTFourierTransform[expr,n,omega]find a numerical approximation to the function F()
NInverseDTFourierTransform[expr,omega,n]find a numerical approximation to the function fn

Discrete-time and continuous-frequency transform pairs: exact and numerical approximations.

This computes the Fourier transform of a discrete-time rectangular function centered at n=0.
In[12]:=
Click for copyable input
Out[12]=
Here is a plot of the amplitude spectrum over three periods.
In[13]:=
Click for copyable input
Out[13]=
Here is a numerical approximation to the inverse discrete-time Fourier transform, for n=-5, ..., 5.
In[14]:=
Click for copyable input
Out[14]=
The Fourier exponential series and discrete-time Fourier transforms are mathematically equivalent, if one exchanges the roles of time and frequency.
setting discrete-time Fourier transform inverse discrete-time Fourier coefficient
{0, 1} fn e2in
{a, b} b (1-a)/2fn e2ibn

Effect of FourierParameters setting on discrete-time Fourier transform.