Accelerating the pace of engineering and science

# Documentation

### Contents

Add patterns for the Fourier transform

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```fourier::addpattern(pat, t, w, res, <vars, <conds>>)
```

## Description

fourier::addpattern(pat, t, w, res) teaches fourier to return res for the expression pat.

The fourier function uses a set of patterns for computing Fourier transforms. You can extend the set by adding your own patterns. To add a new pattern to the pattern matcher, use fourier::addpattern. MuPAD® does not save custom patterns permanently. The new patterns are available in the current MuPAD session only.

After the call fourier::addpattern(pat, t, w, res), the fourier function returns res for the expression pat. Note that the Fourier transform is defined as , where c and s are the parameters specified by Pref::fourierParameters. If you add a new pattern, and then change the Fourier transform parameters, the result returned by fourier(pat, t, w) will also change. See Example 2.

Variable names that you use when calling fourier::addpattern can differ from the names that you use when calling fourier. See Example 3.

You can include a list of free parameters and a list of conditions on these parameters. These conditions and the result are protected from premature evaluation. This means that you can use not   iszero(a^2 - b) instead of hold( _not @ iszero )(a^2 - b).

The following conditions treat assumptions on identifiers differently:

• a^2 - b <> 0 takes into account assumptions on identifiers.

• not   iszero(a^2 - b) disregards assumptions on identifiers.

See Example 4 and Example 5.

## Environment Interactions

The Fourier pair (pat, res) holds only for the current values of the Fourier transform parameters specified by Pref::fourierParameters.

Calling fourier::addpattern can change the expressions returned by future calls to fourier and ifourier in the current MuPAD session.

## Examples

### Example 1

Compute the Fourier transform of the function foo. By default, MuPAD does not have a pattern for this function:

`fourier(foo(t), t, w)`

`fourier::addpattern(foo(t), t, w, bar(w)):`

Now fourier returns the Fourier transform of foo:

`fourier(foo(t), t, w)`

After you add a new transform pattern, MuPAD can use that pattern indirectly:

`fourier(t^3 + a*foo(2*t - 4), t, w)`

### Example 2

Add this new Fourier transform pattern for the function foo:

```fourier::addpattern(foo(t), t, w, bar(w)):
fourier(foo(t), t, w)```

Now change the Fourier transform parameters using Pref::fourierParameters:

`Pref::fourierParameters(a, b):`

Evaluate the transform with the new parameters:

`fourier(foo(t), t, w)`

For further computations, restore the default values of the Fourier transform parameters:

`Pref::fourierParameters(NIL):`

### Example 3

Define the Fourier transform of foo(x) using the variables x and y as parameters:

`fourier::addpattern(foo(x), x, y, bar(y)):`

The fourier function recognizes the added pattern even if you use other variables as parameters:

`fourier(foo(t), t, w)`

### Example 4

Use assumptions when adding the following pattern for the Fourier transform:

```fourier::addpattern(foo(x, t), t, w, bar(x, w), [x], [abs(x) < 1]):
fourier(foo(x, t), t, w) assuming -1 < x < 1```

If |x| ≥ 1, you cannot apply this pattern:

`fourier(foo(x, t), t, w) assuming x > 1`

If MuPAD cannot determine whether the conditions are satisfied, it returns a piecewise object:

`fourier(foo(x, t), t, w)`

### Example 5

Add this pattern for the Fourier transform of f:

```fourier::addpattern(f(a, t), t, w, g(a, w)/a):
fourier(f(a, T), T, W)```

This pattern holds only when the first argument of f is the symbolic parameter a. If you use any other value of this parameter, fourier ignores the pattern:

```fourier(f(b, T), T, W);
fourier(f(2, T), T, W)```

To use the pattern for arbitrary values of the parameter, declare the parameter a as an additional pattern variable:

`fourier::addpattern(f(a, t), t, w, g(a, w)/a, [a]):`

Now fourier applies the specified pattern for an arbitrary value of a:

`fourier(f(2, T), T, W)`

`fourier(f(a^2 + 1, T), T, W)`

Note that the resulting expression g(a, w)/a defining the Fourier transform of f(a, t) implicitly assumes that the value of a is not zero. A strict definition of the pattern is:

`fourier::addpattern(f(a, t), t, w, g(a, w)/a, [a], [a <> 0]):`

For this particular pattern, you can omit specifying the assumption a <> 0 explicitly. If a = 0, MuPAD throws an internal "Division by zero." error and ignores the pattern:

`fourier(f(0, T), T, W)`

## Parameters

 pat Arithmetical expression in the variable t representing the pattern to match t Identifier or indexed identifier used as a variable in the pattern w Identifier or indexed identifier used as a variable in the result res Arithmetical expression in the variable w representing the pattern for the result of the transform vars List of identifiers or indexed identifiers used as "pattern variables" (placeholders in pat and res). You can use pattern variables as placeholders for almost any MuPAD expressions not containing t or w. You can restrict them by conditions given in the optional parameter conds. conds List of conditions on the pattern variables

## Return Values

Object of type DOM_NULL