Documentation

## If You Want to Simplify Results Further

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

### Increase the Number of Simplification Steps

When simplifying a complicated expression, MuPAD® can return results that would benefit from further simplifications. Suppose you want to simplify the following expression:

```f := (-(4*PI*3^(1/2))/3 + PI*(-1)^(3/4)*2^(1/2)*3^(1/2) *(- (2*I)/3 - 2/3))*(cos(3*arccos(x)))```

First, try calling the general simplifier `simplify`:

`simplify(f)`

The returned expression has an even shorter representation. To simplify this result further, call the `Simplify` command:

`Simplify(f)`

You can simplify the result even more by increasing the number of steps:

`Simplify(f, Steps = 150)`

### Apply Several Simplification Functions

To transform a very complicated expression or an expression that should appear in a particular form, you might need to apply several simplification functions. When you transform an expression to a particular form by using a special transformation function, the function can return can return results that are not fully simplified. Suppose you want to rewrite the trigonometric expression in terms of exponential functions. The `rewrite` command replaces the `sin` and `cos` functions by exponential functions, but does not simplify the result:

`f := rewrite(sin(x)/cos(x), exp)`

To simplify the resulting expression, call the `simplify` command:

`simplify(f)`

The more powerful `Simplify` function converts this expression back to its trigonometric form:

`Simplify(f)`

### Use Options

When transforming expressions, the MuPAD simplifiers apply the rules valid for the entire complex plane. For example, try to simplify this expression containing logarithms:

`h := ln(x + 1)/2 - ln(1 - 1/x)/2 - ln(1 - x)/2 + ln(1/x + 1)/2`

By default, the simplifier does not combine logarithms because this operation is only valid for particular real numbers. For complex numbers, combining logarithms is not generally valid:

`Simplify(h)`

If you solve a problem that does not require application of strict mathematical rules, try using the `IgnoreAnalyticConstraints` option. With this option, the simplifier uses a set of mathematical rules that are not generally correct. For example, if you use the `IgnoreAnalyticConstraints` option, the simplifier returns:

`Simplify(h, IgnoreAnalyticConstraints)`

The results obtained with the option `IgnoreAnalyticConstraints` are most useful for many in engineering and physics problems. Note that when you use this option, the simplifiers do not guarantee the equivalence of the original and simplified expressions for the entire complex plane.

### Use Assumptions

When transforming an expression, the simplification functions apply the rules valid for the entire plane of complex numbers. By default, MuPAD does not assume any additional mathematical properties on the identifiers. For example, the identity is not generally valid for all complex numbers:

`simplify(ln(exp(x)))`

When you work with real numbers, the simplification functions can also use the rules valid for real numbers. Use the `assume` or `assuming` command to specify that a variable `x` represents a real number. The `assume` command creates a permanent assumption. The `assuming` command creates a temporary assumption, which is valid during a single command. The simplifier applies the appropriate rule and returns the expected result:

`simplify(ln(exp(x))) assuming x in R_`

When you simplify the following expression, the returned expression is shorter than the original one. However, you can further simplify the returned expression:

```f := ln(- 2*sin(-(sin(x)*I)/2)^2 + sin(-sin(x)*I)*I + 1); Simplify(f)```

Increasing the number of steps simplifies the expression further:

`Simplify(f, Steps = 300)`

If you want to get a simplified result for real `x`, assume that `x` is real:

```assume(x, Type::Real); Simplify(f, Steps = 300)```

To remove an assumption, use the `unassume` command:

```unassume(x); is(x, Type::Real)```

When assuming any additional mathematical property for a variable (such as assuming that `x` is real), make sure that your problem does not require solutions to be valid for all complex numbers. Be especially careful if your initial expression contains complex numbers.