# Documentation

## Convert Expressions Involving Special Functions

 Note:   Use only in the MuPAD Notebook Interface. This functionality does not run in MATLAB.

### Simplify Special Functions Automatically

MuPAD® provides many special functions commonly used in engineering and science. MuPAD uses standard mathematical notations for special functions. If you do not recognize a notation, see Mathematical Notations Uses in Typeset Mode.

Particular parameter choices can simplify special functions. Often MuPAD handles such simplifications automatically. For example, the following parameters reduce hypergeometric functions to elementary functions:

```hypergeom([], [], z); hypergeom([1], [], z); hypergeom([a], [], z)```

### Use General Simplifiers to Reduce Special Functions

MuPAD does not automatically simplify some functions. For example, it does not automatically simplify the Meijer G special function:

`meijerG([[], []], [[1], []], z)`

The general simplification functions, `simplify` and `Simplify`, represent this expression in terms of elementary functions:

`simplify(meijerG([[], []], [[1], []], z))`

MuPAD also does not use automatic simplifications for many expressions involving special functions. Suppose you get an expression containing the Fresnel sine integral function:

`2*fresnelS(z) + fresnelS(-z)`

To apply the reflection rule `fresnelS(-z) = -fresnelS(z)` and simplify this expression, explicitly call one of the general simplifiers:

`simplify(2*fresnelS(z) + fresnelS(-z))`

Particular values of parameters can reduce more general special functions to expressions containing simpler special functions. For example, reduce `meijerG` to the hypergeometric functions:

`Simplify(meijerG([[1/3, 1/3, 3/2], []], [[0], [-2/3, 4/3]], z))`

The following choice of parameters expresses `meijerG` in terms of the Bessel functions:

`simplify(meijerG([[], []], [[1], [1]], z))`

### Expand Expressions Involving Special Functions

MuPAD supports expansions of expressions containing special functions. The resulting expressions can involve the original or additional special functions, or both. For example, the `expand` command expresses the beta function by gamma functions:

`beta(x + 1, y) = expand(beta(x + 1, y))`

When you expand the gamma function, MuPAD expresses it in terms of gamma functions:

`gamma(5*x + 1) = expand(gamma(5*x + 1))`

### Verify Solutions Involving Special Functions

When solving equations (especially ordinary differential equations), you often get the results in terms of special functions. For example, consider the following differential equation:

`eq := diff(y(x), x, x) - x^3*y(x) = 0`

For this ODE, the solver returns the result in terms of the Bessel functions:

`S := solve(ode(eq, y(x)))`

To verify correctness of the returned solution, try substituting it into the original equation by using `evalAt` or its shortcut `|`. You get the following long and complicated result that still contains the Bessel special functions. MuPAD does not automatically simplify this result:

`eq | y(x) = S[1]`

Simplifying this expression proves the correctness of the solution:

`simplify(eq | y(x) = S[1])`

The `testeq` command serves best for verifying correctness of the solutions. The command automatically simplifies expressions on both sides of the equation:

`testeq(eq | y(x) = S[1])`