# Documentation

Add patterns for the Laplace transform

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```laplace::addpattern(`pat`, `t`, `s`, `res`, <`vars, <conds>`>)
```

## Description

`laplace::addpattern(pat, t, s, res)` teaches `laplace` to return .

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

Variable names that you use when calling `laplace::addpattern` can differ from the names that you use when calling `laplace`. See Example 2.

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.

## Environment Interactions

Calling `laplace::addpattern` changes the expressions returned by future calls to `laplace`.

## Examples

### Example 1

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

`laplace(foo(t), t, s)`

Add a pattern for the Laplace transform of `foo` using `laplace::addpattern`:

`laplace::addpattern(foo(t), t, s, bar(s)):`

Now `laplace` returns the Laplace transform of `foo`:

`laplace(foo(t), t, s)`

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

`laplace(t^3 + exp(2*t)*foo(t), t, s)`

### Example 2

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

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

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

`laplace(foo(t), t, s)`

### Example 3

Add this pattern for the Laplace transform of `f`:

```laplace::addpattern(f(a*x)*g(a*x), x, y, y/(y^4 + 4*a^4)): laplace(f(a*v)*g(a*v), v, 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, `laplace` ignores the pattern:

`laplace(f(A*v)*g(A*v), v, w)`

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

`laplace::addpattern(f(a*x)*g(a*x), x, y, y/(y^4 + 4*a^4), [a]):`

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

`laplace(f(A*v)*g(A*v), v, w)`

### Example 4

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

```laplace::addpattern(FOO(x*t), t, s, sin(1/(x-1/2))*BAR(s), [x], [abs(x) < 1]): laplace(FOO(x*t),t,s) assuming -1 < x < 1```

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

`laplace(FOO(x*t),t,s) assuming x >= 1`

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

`laplace(FOO(x*t), t, s)`

Note that the resulting expression defining the Laplace transform of `FOO(x*t)` implicitly assumes that the value of `x` is not 1/2. A strict definition of the pattern is:

```laplace::addpattern(FOO(x*t), t, s, sin(1/(x-1/2))*BAR(s), [x], [abs(x) < 1, x <> 1/2]):```

If either the conditions are not satisfied or substituting the values into the result gives an error, `laplace` ignores the pattern. For this particular pattern, you can omit specifying the assumption ```x <> 1/2```. If `x = 1/2`, MuPAD throws an internal "Division by zero." error and ignores the pattern:

`laplace(FOO(1/2*t), t, s)`

## 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 `s` Identifier or indexed identifier used as a variable in the result `res` Arithmetical expression in the variable `s` representing the pattern for the result of the transformation `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 `t` or `s`. 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`