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] ] gives 3 Sqrt[2] and Calculate[ Sin[Pi] ] gives Sin[Pi]. A division that has no integer result is kept: Calculate[ 12/8 ] gives 12/8.
  • Sums with variables: in a sum with a variable, the numbers are not always combined: Calculate[ 2*3 + 4 + x ] gives 6+4+x. Use Simplify to get 10+x.

See also: Simplify, CalcPlus, CalcTimes, Numerical