next up previous contents index
Next: 3.4 List of commands Up: 3. Manual Previous: 3.2 Operations on functions   Contents   Index

Subsections


3.3 Transforms

Two transforms are implemented in the program funct : the Fourier transform (with its variant the FFT transform) and the Bessel transform. The second is computed from the first, so here the Bessel transform of a function is rather a transform of its Fourier transform.




3.3.1 Fourier transforms

In funct it is possible to compute Fourier transforms and FFTs of functions.



3.3.1.1 FFTs in funct

We will first define what we mean by the FFT of a function $f(x)$ on $N$ points. Suppose that the function is defined on the interval $[0,L]$. Then we take the $N$ values $f(i\frac{L}{N-1})$, $0\leq i<N$, and make the usual FFT transform of them, which give

\begin{displaymath}z_m \ = \ T_Nf(\frac{2m\pi}{L})\end{displaymath}

for $0\leq m\leq N/2$. We can easily deduce the value of $T_Nf(\frac{2m\pi}{L})$for $N/2\leq m\leq N$ :

\begin{displaymath}T_Nf(\frac{2m\pi}{L}) = \overline{z_{N-m}}.\end{displaymath}

We obtain then $T_Nf(\frac{2m\pi}{L})$ for any integer $m$ by periodicity.

Now what we call FFT transform of $f$ here is the continuous function which is the same as $T_Nf$ at the points $x_m=\frac{2m\pi}{L}$, and which is linear between $x_m$ and $x_{m+1}$.

The command to compute FFTs is the following :

 - funct -> fft f1 f2 N

Here f1 is a real or complex function, f2 a complex function with the same precision as f1. This command computes the FFT of f1 on N points and puts the result in f2 (N must be a power of 2).As for the other commands of funct involving functions, f1 and f2 can have any x-ranges.



3.3.1.2 Fourier transforms

By Fourier transform of a function $f$ we mean the function $Tf(t)$ defined in 2.2. This is not the same as a single FFT, and the computation requires several FFTs, as explained in 2.2. To define the Fourier transform of a function (real or complex), the command def_four is used (cf 3.4). For example, if f1 is a real function, the instruction


def_four tr f1 1024


computes the parameters associated to the Fourier transform of the function f1, which are stored in the object tr. The FFT's are made on 1024 points. Given a complex function C the instruction


trans_four tr C


will then compute the Fourier transform of f1 at the points of the x-range of C and put the result in C. It is of course possible to use several times the object tr (for other C).

See 3.4 for more details on these commands.




3.3.2 Bessel transforms

To compute Bessel transforms of a real function $f$ we need first its Fourier transform :


def_four tr f 1024


for example. We define also a new kind of object which contains some parameters to compute the last two formulas of 4.2.1 (i.e. some values of the $\sin\theta$ and $\cos(n\theta)$ or $\sin(n\theta)$). This is done with the instruction


def_bes_par xx n n2


Here xx is the name of the object that will contain the parameters, n is the number of the Bessel transform and n2 the number of points in the interval $[0,\frac{2}{\pi}]$ used to compute the integrals. The same object can be used to compute the n-th Bessel tranform of other functions. To compute the Bessel transform of order n of $f$ we use the instruction


trans_bessel tr xx g


where g is a real function that will contain the result.


next up previous contents index
Next: 3.4 List of commands Up: 3. Manual Previous: 3.2 Operations on functions   Contents   Index
jmdr 2003-10-01