The command fourier takes one to three arguments: an expression f(x) and (optionally) identifiers x and s . It returns the Fourier transform F of f defined by
F(s)= | ∫ |
| e−i s x f(x) dx, s∈ℝ. (5) |
If s is not given, F is returned as a function of x .
The command ifourier works the other way round: it takes arguments F(s) and (optionally) s and x , and returns the expression f(x) using the formula
f(x)= |
| ∫ |
| ei s x F(s) ds. |
To compute the above integral, fourier is called with input parameters F(s)/2 π , s and x , replacing x with −x in the result.
Arbitrary rational functions can be transformed. For example, to find the Fourier transform of f(x)=x/x3−19 x+30 , input:
Output:
Input:
Output:
Similarly, to find the transform of f(x)=x2+1/x2−1 , input:
Output:
Input:
Output:
A range of other (generalized) functions and distributions can be transformed, as demonstrated in the following examples. If fourier does not know how to transform a function, say f , it returns the unevaluated integral (5). In these cases one may try to evaluate the result using eval.
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
In the following example we compute the convolution of f(x)=e−|x| with itself using the convolution theorem. Input:
Output:
Input:
Output:
The above result is the desired convolution f∗ f(x)=∫−∞+∞f(t) f(x−t) dt .
Piecewise functions can be transformed if defined as
where a1,a2,…,an are real numbers such that a1<a2<⋯<an . Inequalities may be strict or non-strict.
Input:
Output:
The original function f is obtained from the above result by applying ifourier. Input:
Output:
One may verify that the above expression is equal to f(x) by plotting.
To transform unknown functions, one can use the command addtable which takes five arguments: fourier or laplace (to indicate the desired transform definition), f(x) , F(s) , x and s , where f , F , x and s are identifiers. If the first argument is fourier, this means that F{f(x)}(s)=F(s) i.e. that the command
would return F(s). The return value of addtable is 1 on success and 0 on failure. The second and the third argument can also be expressions depending on several variables.
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Input:
Output:
Fourier transform can be used for solving linear differential equations with constant coefficients. For example, we obtain a particular solution to the equation
y(x)+4 y(4)(x)=δ(x), |
where δ is the Dirac delta function. First we transform both sides of the above equation. Input:
Output:
Then we solve the equation L=R for Y(s) . Generally, one should apply csolve instead of solve. Input:
Output:
Finally, we apply ifourier to obtain y(x) . Input:
Output:
The above solution can be combined with solutions of the corresponding homogeneous equation to obtain the general solution.