features SciMax Toolbox fib

SciMax Toolbox >> fft

fft

Maxima Function

Calling Sequence

fft (real_array, imaginary_array)
ift(real_array,imaginary_array)
recttopolar(real_array,imaginary_array)
polartorect(magnitude_array,phase_array)

Description

Fast Fourier transform and related functions. load ("fft") loads these functions into Maxima.

fft and ift carry out the complex fast Fourier transform and inverse transform, respectively, on 1-dimensional floating point arrays. The size of imaginary_array must equal the size of real_array.

fft and ift operate in-place. That is, on return from fft or ift, the original content of the input arrays is replaced by the output. The fillarray function can make a copy of an array, should it be necessary.

The discrete Fourier transform and inverse transform are defined as follows. Let x be the original data, with

x[i]: real_array[i] + %i imaginary_array[i]

Let y be the transformed data. The forward and inverse transforms are

y[k]: (1/n) sum (x[j] exp (-2 %i %pi j k / n), j, 0, n-1)
x[j]:       sum (y[j] exp (+2 %i %pi j k / n), k, 0, n-1)

Suitable arrays can be allocated by the array function. For example:

array (my_array, float, n-1)$

declares a 1-dimensional array with n elements, indexed from 0 through n-1 inclusive. The number of elements n must be equal to 2^m for some m.

fft can be applied to real data (imaginary array all zeros) to obtain sine and cosine coefficients. After calling fft, the sine and cosine coefficients, say a and b, can be calculated as

a[0]: real_array[0]
b[0]: 0

and

a[j]: real_array[j] + real_array[n-j]
b[j]: imaginary_array[j] - imaginary_array[n-j]

for j equal to 1 through n/2-1, and

a[n/2]: real_array[n/2]
b[n/2]: 0

recttopolar translates complex values of the form a + b %i to the form r %e^(%i t). See .

polartorect translates complex values of the form r %e^(%i t) to the form a + b %i. See .

demo ("fft") displays a demonstration of the fft package.

features SciMax Toolbox fib