Simplify an expression
MuPAD® notebooks are not recommended. 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.
simplify(f
, <target
>,options
) simplify(L
, <target
>,options
)
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.
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 termrewriting rules
to the original expression, rewrites the expression according to these
rules, takes the result, and applies the next set of termrewriting
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.
simplify
reacts to properties of
identifiers.
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)
To simplify Boolean expressions, use the logic
target:
simplify((a and b) or (a and (not b)), logic)
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)
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.
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 = 50)
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 contextfree. Therefore, you cannot implement the reverse rule
in a simplification attribute.
 

A container object: an array, an hfarray, a list, a matrix, a polynomial, a set, or a table. 

One of the identifiers 

With this option the simplifier applies the following rules to expressions:
Using the 

Limit the time allowed for the internal simplification process. The value denotes the maximal time in seconds. By default, the simplification time is unlimited. 

Terminate algebraic simplification after the specified number
of simplification steps. The value must be a positive integer. the
default number of simplification steps is 
Object of the same type as the input object f
or L
,
respectively.
f
, L