Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# simplify

Simplify an expression

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```simplify(f, <target>, options)
simplify(L, <target>, options)
```

## Description

simplify(f) tries to simplify the expression f by applying term rewriting rules.

simplify(f, target) restricts the simplification to term rewriting rules applicable to one or more target functions.

 Note:   The cos, sin, exp, ln, and sqrt targets has been removed. Use simplify function calls without these targets. Alternatively, use radsimp instead of simplify with the sqrt target.

The simplify function performs sequential simplifications. It applies a certain set of term-rewriting rules to the original expression, rewrites the expression according to these rules, takes the result, and applies the next set of term-rewriting rules. The simplify function assumes that the output of every rule is "simpler" than the input without further checks. Generally, this method is faster, but less reliable and controllable than the algorithm used by Simplify.

If you do not specify a target, simplify tries to simplify the whole expression. This first step includes rewriting of products of trigonometric and exponential terms. After that, the function tries to simplify the operands of the expression. If an expression contains special functions, MuPAD® calls, the simplification methods available for these functions.

The call simplify(L, target ) applies simplifications to the operands of the object L.

If you specify the logic target, the simplify function simplifies Boolean expressions. With the logic target, simplify does not use properties and assumptions specified for the terms of Boolean expressions.

If you specify the condition target, the simplify function simplifies Boolean expressions. With the condition target, simplify uses properties and assumptions specified for the terms of Boolean expressions.

## Environment Interactions

simplify reacts to properties of identifiers.

## Examples

### Example 1

Use the simplify function to simplify the following algebraic expressions:

`simplify(exp(x)-exp(x/2)^2)`

```f := ln(x) + ln(3) - ln(3*x) + (exp(x) - 1)/(exp(x/2) + 1):
simplify(f)```

### Example 2

To simplify Boolean expressions, use the logic target:

`simplify((a and b) or (a and (not b)), logic)`

### Example 3

Alternatively, to simplify Boolean expressions, use the condition target. With the condition target, simplify uses the properties and assumptions specified for the terms of Boolean expressions. With the logic target, simplify ignores those properties and assumptions:

`simplify(x > x, condition), simplify(x > x, logic)`

### Example 4

The option IgnoreAnalyticConstraints allows you to get simpler results using a set of purely algebraic simplifications:

`simplify(ln(x^2 + 2*x + 1) - ln(x + 1))`

`simplify(ln(x^2 + 2*x + 1) - ln(x + 1), IgnoreAnalyticConstraints)`

If you use this option, the simplifier does not guarantee the equality of the initial expression and the result for all symbolic parameters.

### Example 5

To change the number of simplification steps, use the Steps option:

```f := ((exp(-x*i)*i)/2 - (exp(x*i)*i)/2)/(exp(-x*i)/2 + exp(x*i)/2):
simplify(f);
simplify(f, Steps = 10);
simplify(f, Steps = 30)```

### Example 6

Your custom functions can have simplification attributes. For example, suppose you know that f is an additive function, but you do not know more about f. Therefore, you cannot compute the function value of at any point except zero, but you can use the additivity:

```f := funcenv( x -> if iszero(x) then 0 else procname(x) end):
f::simplify := proc(F)
local argument;
begin
argument := op(F,1);
if type(argument) = "_plus" then
map(argument, f)
else
F
end
end:```
`f(x + 3*y) - f(3*y) = simplify(f(x + 3*y) - f(3*y))`

You can refine the simplification attribute of f further. For example, you can specify that it must turn f(3*y) into 3*f(y). The reverse rule (rewriting f(x) + f(y) as f(x + y)) is not context-free. Therefore, you cannot implement the reverse rule in a simplification attribute.

## Parameters

 f L A container object: an array, an hfarray, a list, a matrix, a polynomial, a set, or a table. target One of the identifiers unit, logic, or condition

## Options

 IgnoreAnalyticConstraints With this option the simplifier applies the following rules to expressions: ln(a) + ln(b) = ln(a b) for all values of a and b. In particular: for all values of a, b, and cln(ab) = b ln(a) for all values of a and b. In particular: for all values of a, b, and cIf f and g are standard mathematical functions and f(g(x)) = x for all small positive numbers, f(g(x)) = x is assumed to be valid for all complex x. In Particular: arcsin(sin(x)) = x, arccos(cos(x)) = x, arctan(tan(x)) = xarcsinh(sinh(x)) = x, arccosh(cosh(x)) = x, arctanh(tanh(x)) = x for all values of k Using the IgnoreAnalyticConstraints option can give you simple results for expressions for which the direct use of the simplifier returns complicated results. With this option the simplifier does not guarantee the equality of the initial expression and the result for all symbolic parameters. See Example 4. Seconds Limit the time allowed for the internal simplification process. The value denotes the maximal time in seconds. By default, the simplification time is unlimited. Steps Terminate algebraic simplification after the specified number of simplification steps. The value must be a positive integer. the default number of simplification steps is 1.

## Return Values

Object of the same type as the input object f or L, respectively.