Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

### Contents

Add patterns for the inverse Fourier transform

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

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

## Description

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

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

After the call ifourier::addpattern(pat, w, t, res), the ifourier function returns res for the expression pat. Note that the inverse 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 ifourier(pat, w, t) will also change. See Example 2.

Variable names that you use when calling ifourier::addpattern can differ from the names that you use when calling ifourier. 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. That means 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 ifourier::addpattern can change the expressions returned by future calls to fourier and ifourier in the current MuPAD session.

## Examples

### Example 1

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

`ifourier(bar(w), w, t)`

Add a pattern for the inverse Fourier transform of bar using ifourier::addpattern:

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

Now ifourier returns the Fourier transform of bar:

`ifourier(bar(w), w, t)`

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

`ifourier(exp(-a*I*s)*bar(2*s + 10), s, t)`

### Example 2

Add this pattern for the inverse Fourier transform of the function bar:

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

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

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

Evaluate the transform with the new parameters:

`ifourier(bar(w), w, t)`

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

`Pref::fourierParameters(NIL):`

### Example 3

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

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

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

`ifourier(bar(w), w, t)`

### Example 4

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

```ifourier::addpattern(bar(x, w), w, t, foo(x, t), [x], [abs(x) < 1]):
ifourier(bar(x, w), w, t) assuming abs(x) < 1/2```

If |x| ≥ 1, you cannot apply these patterns:

`ifourier(bar(x, w), w, t) assuming x < -1`

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

`ifourier(bar(x, w), w, t)`

### Example 5

Add this pattern for the inverse Fourier transform of g:

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

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

```ifourier(g(b, W), W, T);
ifourier(g(2, W), W, T)```

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

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

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

`ifourier(g(2, W), W, T)`

`ifourier(g(a^2 + 1, W), W, T)`

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

`ifourier::addpattern(g(a, w), w, t, f(a, t)/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:

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

## Parameters

 pat Arithmetical expression in the variable w representing the pattern to match w Identifier or indexed identifier used as a variable in the pattern t Identifier or indexed identifier used as a variable in the result res Arithmetical expression in the variable t representing a pattern for the result 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 arbitrary MuPAD expressions not containing w or t. 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