This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / The Mathematica Book / Advanced Mathematics in Mathematica / Algebraic Manipulation /

3.3.9 Simplification

Simplifying expressions.

Mathematica does not automatically simplify an algebraic expression like this.

In[1]:= (1 - x)/(1 - x^2)

Out[1]=

Simplify performs the simplification.

In[2]:= Simplify[%]

Out[2]=

Simplify performs standard algebraic and trigonometric simplifications.

In[3]:= Simplify[Sin[x]^2 + Cos[x]^2]

Out[3]=

It does not, however, do more sophisticated transformations that involve, for example, special functions.

In[4]:= Simplify[Gamma[1+n]/n]

Out[4]=

FullSimplify does perform such transformations.

In[5]:= FullSimplify[%]

Out[5]=

Controlling simplification.

Here is an expression involving trigonometric functions and square roots.

In[6]:= t = (1 - Sin[x]^2) Sqrt[Expand[(1 + Sqrt[2])^20]]

Out[6]=

By default, FullSimplify will try to simplify everything.

In[7]:= FullSimplify[t]

Out[7]=

This makes FullSimplify avoid simplifying the square roots.

In[8]:= FullSimplify[t, ExcludedForms->Sqrt[_]]

Out[8]=

Further control of simplification.

In both Simplify and FullSimplify there is always an issue of what counts as the "simplest" form of an expression. You can use the option ComplexityFunction -> c to provide a function to determine this. The function will be applied to each candidate form of the expression, and the one that gives the smallest numerical value will be considered simplest.

With its default definition of simplicity, Simplify leaves this unchanged.

In[9]:= Simplify[4 Log[10]]

Out[9]=

This now tries to minimize the number of elements in the expression.

In[10]:= Simplify[4 Log[10], ComplexityFunction -> LeafCount]

Out[10]=