The Fourier transform
A Fourier series describes a function on an interval by a list of coefficients. The Fourier transform does the same for a function on the whole line, and the list becomes a function of a continuous frequency. fourierTransform(f) gives its values as certified enclosures, and, when f is one of the standard pairs, the formula as well.
const T = fourierTransform("exp(-x^2)");
T.at(2); // { re, im }: two certified integrals
T.formula.text; // "sqrt(pi)*exp(-1/4*w^2)"
T.check("1/3").agrees; // formula and integral side by side
T.parseval(); // { time, frequency, agrees }
T.inversion("1/2"); // the inverse transform beside f(1/2)
That is the default convention, "angular". convention: "unitary" puts on both integrals, and "frequency" uses with no factor on either. Whichever is chosen is used consistently by the inverse, by Parseval and by the checks.
Values
Since , the real part of F(ω) is the integral of f(x) cos ωx and the imaginary part is minus the integral of f(x) sin ωx. Each is an improper integral, and at(ω) returns the two enclosures. They are proven: the part of the line far out is bounded from the leading behaviour of f, which is the reason the function must be absolutely integrable. For 1/(1 + |x|) the integral of |f| diverges and at refuses. A function that is zero outside an interval is given with support: [a, b]; an end may be "inf".
When f decays only like a power of x, the far part is known only by a bound and the enclosure is correspondingly wider (a few digits for 1/(1 + x²)). It is still an enclosure.
The standard pairs
| f(x) | F(ω) | name |
|---|---|---|
| Gaussian | ||
| two-sided exponential | ||
| Lorentzian | ||
| for x > 0, else 0 | one-sided exponential | |
| 1 on [a, b], else 0 | box |
Three rules extend the table. A shift f(x − c) multiplies the transform by . Multiplying f by x differentiates the transform: . And the transform is linear, so sums go term by term. With these, fourierTransform recognises any sum of terms of the form polynomial times or polynomial times , the Lorentzian with any centre, polynomial times on [0, ∞), and constants on a finite interval.
A formula found this way is compared with the certified integrals at two frequencies before it is returned, so its trust is "checked": a wrong formula cannot come back. When f is not in the table, formula is null and the values are still available.
Parseval and inversion
parseval() encloses both sides, the right one from the formula, and reports whether the enclosures meet. inversion(x) does the same for the inversion theorem: the inverse transform of the formula at x beside f(x). inverseFourier(F) is the inverse on its own, for a formula F you supply (a string for a real F, or { re, im }).
Convolution
convolution(f, g).at(x) is the integral, enclosed. .theorem(x) computes the same number a second way, as the inverse transform of the product of the two formulas, and checks that the two enclosures meet.
The heat equation on the whole line
Transforming in x turns it into , so each frequency simply decays: . Multiplying by a Gaussian in ω is convolving with a Gaussian in x:
heatLine({ k, initial }) gives at(x, t) from that integral, viaTransform(x, t) from the decaying frequencies, and check(x, t) for both together. heat() is the total , which does not change with time. On an interval the same equation is solved by Fourier series, and the wave equation on the whole line is wave({ c, position, velocity }) with no length, by d'Alembert's formula.
| call | returns |
|---|---|
| fourierTransform(f, { variable = "x", frequency = "w", convention, support, digits = 15 }) | FourierTransform |
| T.at(ω), T.formulaAt(ω) | { re, im } of RationalInterval |
| T.formula, T.pairs | { re, im, text, trust } or null; the names of the pairs used |
| T.check(ω), T.parseval(), T.inversion(x) | both sides and agrees |
| inverseFourier(F, { variable = "w", convention }).at(x) | { re, im } |
| convolution(f, g).at(x), .theorem(x) | RationalInterval; { convolution, viaTransforms, transform, agrees } |
| heatLine({ k = 1, initial, support }).at(x, t), .viaTransform(x, t), .check(x, t), .heat() | RationalInterval |
@ratmath/analytic and Core's R, Rational, RationalInterval in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.