Simplify
Simplify
Simplify[ expr ] fully simplifies an expression, executing any task commands in it.
Usages
Simplify[ expr ]
In a script, expressions are not calculated or simplified by themselves: res := 2x*x stores 2x*x as it is. Simplify[ expr ] lets the math engine simplify expr as far as possible: it calculates numbers, combines terms, evaluates comparisons and executes task commands such as Solve, Expand and Factor.
| Example | in | out |
|---|---|---|
Without Simplify. |
res := 2x*x |
res = 2x x |
With Simplify. |
res := Simplify[2x*x] |
res = 2x^2 |
| Calculate numbers. | Simplify[ 2 + 3*4 ] |
14 |
| Add fractions. | Simplify[ 1/2 + 1/3 ] |
5/6 |
| Exact values of standard functions. | Simplify[ Sin[Pi] ] |
0 |
| Simplify an algebraic expression. | Simplify[ x(x+1) - x^2 ] |
x |
| Simplify a fraction. | Simplify[ (x^2 + 4x + 3)/(x + 1) ] |
x+3 |
| Each element of a list. | Simplify[ {1+1, 2*3} ] |
{2, 6} |
| Evaluate a comparison. | Simplify[ 2 < 4 ] |
True |
Simplify[ task ]
Task commands only do their work inside Simplify. See the task commands for all tasks.
| Example | in | out |
|---|---|---|
| Solve an equation. | Simplify[ Solve[x^2 = 4, x] ] |
Solution[Or[x=2, x=-2], x] |
| Factor an expression. | Simplify[ Factor[x^2 + x] ] |
x(x+1) |
| Expand brackets. | Simplify[ Expand[(x+1)^2] ] |
Details
- What is "simplest":
Simplifydoes not expand or factor by itself.Simplify[ x^2 + x ]staysx^2+xandSimplify[ x(x+1) ]staysx(x+1). UseExpandorFactorto choose the form. - Roots are not rewritten:
Simplify[ Sqrt[8] ]staysSqrt[8]. - Script debug information: polynomial results can be shown there in an internal form, such as
Poly[{1,2,1}, {2,1,0}, x]forx^2+2x+1. In the exercise, they are displayed normally.
Warning
Simplify is intended only for use within the Algebrakit script. Do not use Simplify elsewhere, such as in definitions, instructions or intermediate steps.
See also: Numerical, Substitute, Task commands