|
1.4.6 Advanced Topic: Simplifying with Assumptions

Simplifying with assumptions.
Mathematica does not automatically simplify this, since it is only true for some values of x.
In[1]:= Simplify[Sqrt[x^2]]
Out[1]= 
is equal to for , but not otherwise.
In[2]:= {Sqrt[4^2], Sqrt[(-4)^2]}
Out[2]= 
This tells Simplify to make the assumption x > 0, so that simplification can proceed.
In[3]:= Simplify[Sqrt[x^2], x > 0]
Out[3]= 
No automatic simplification can be done on this expression.
In[4]:= 2 a + 2 Sqrt[a - Sqrt[-b]] Sqrt[a + Sqrt[-b]]
Out[4]= 
If and are assumed to be positive, the expression can however be simplified.
In[5]:= Simplify[%, a > 0 && b > 0]
Out[5]= 
Here is a simple example involving trigonometric functions.
In[6]:= Simplify[ArcSin[Sin[x]], -Pi/2 < x < Pi/2]
Out[6]= 

Some domains used in assumptions.
This simplifies assuming that is a real number.
In[7]:= Simplify[Sqrt[x^2], Element[x, Reals]]
Out[7]= 
This simplifies the sine assuming that is an integer.
In[8]:= Simplify[Sin[x + 2 n Pi], Element[n, Integers]]
Out[8]= 
With the assumptions given, Fermat's Little Theorem can be used.
In[9]:= Simplify[Mod[a^p, p], Element[a, Integers]
&& Element[p, Primes]]
Out[9]= 
This uses the fact that , but not , is real when is real.
In[10]:= Simplify[Re[{Sin[x], ArcSin[x]}], Element[x, Reals]]
Out[10]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. |