Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

simple - Search for simplest form of symbolic expression

Syntax

r = simple(S)
[r, how] = simple(S)

Description

r = simple(S) tries several different algebraic simplifications of the symbolic expression S, displays any that shorten the length of S's representation, and returns the shortest. S is a sym. If S is a matrix, the result represents the shortest representation of the entire matrix, which is not necessarily the shortest representation of each individual element. If no return output is given, simple(S) displays all possible representations and returns the shortest.

[r, how] = simple(S) does not display intermediate simplifications, but returns the shortest found, as well as a string describing the particular simplification. r is a sym. how is a string.

Examples

Simplify the expressions:

syms x;
f = cos(x)^2 + sin(x)^2;
f = simple(f)
g = cos(3*acos(x));
g = simple(g)

The results are:

f =
1
 
g =
4*x^3 - 3*x

Simplify the expressions displaying all possible simplifications:

syms x;
f = cos(x) + i*sin(x);
simple(f)

The result is:

simplify:
cos(x) + i*sin(x)
 
radsimp:
cos(x) + i*sin(x)
 
simplify(100):
cos(x) + i*sin(x)
 
combine(sincos):
cos(x) + i*sin(x)
 
combine(sinhcosh):
cos(x) + i*sin(x)
 
combine(ln):
cos(x) + i*sin(x)
 
factor:
cos(x) + i*sin(x)
 
expand:
cos(x) + i*sin(x)
 
combine:
cos(x) + i*sin(x)
 
rewrite(exp):
exp(i*x)
 
rewrite(sincos):
cos(x) + i*sin(x)
 
rewrite(sinhcosh):
cosh(-i*x) - sinh(-i*x)
 
rewrite(tan):
(2*i*tan(x/2))/(tan(x/2)^2 + 1) - (tan(x/2)^2 - 1)/(tan(x/2)^2 + 1)
 
mwcos2sin:
- 2*sin(x/2)^2 + i*sin(x) + 1
 
collect(x):
cos(x) + i*sin(x)
 
ans =
exp(i*x)

Simplify the expression and display the simplification method:

syms x;
f = (x + 1)*x*(x - 1);
[f, how] = simple(f)
f =
x^3 - x

how =
simplify(100)

See Also

collect, expand, factor, horner, simplify

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS