Calculate
Calculate
Calculate[ expr ] calculates the numbers in an expression with the Calc commands.
Usages
Calculate[ expr ]
Calculate[ expr ] calculates sums, differences, products and powers of numbers in expr, as CalcPlus, CalcTimes and CalcPower would. Fractions are added and multiplied as well. Parts that cannot be calculated are kept. Unlike Simplify, Calculate does not rewrite algebraic expressions.
| Example | in | out |
|---|---|---|
| Integers. | Calculate[ 2*3 + 4 ] |
10 |
| A negative result. | Calculate[ 3 - 5 ] |
-2 |
| Fractions. | Calculate[ 1/2 + 1/3 ] |
5/6 |
| A power. | Calculate[ 2^10 ] |
1024 |
| Decimal numbers. | Calculate[ 0.1 + 0.2 ] |
0.3 |
| A coefficient. | Calculate[ (2 + 3) * x ] |
5x |
| Each element of a list. | Calculate[ {1+1, 2*3} ] |
{2, 6} |
Details
- Not calculated: roots and functions are kept:
Calculate[ 3 * Sqrt[2] ]gives3 Sqrt[2]andCalculate[ Sin[Pi] ]givesSin[Pi]. A division that has no integer result is kept:Calculate[ 12/8 ]gives12/8. - Sums with variables: in a sum with a variable, the numbers are not always combined:
Calculate[ 2*3 + 4 + x ]gives6+4+x. UseSimplifyto get10+x.