How to | Do Basic Calculations
Mathematica serves as a convenient and extensible environment for doing basic math. In addition to performing advanced calculations, Mathematica can also be used as a powerful calculator with arbitrary precision.
Add two numbers:
| Out[219]= |  |
Subtract a number from another number:
| Out[220]= |  |
Multiply two numbers by using
or a space:
| Out[221]= |  |
Spaces between numbers, variables, or function values are interpreted as multiplication. Mathematica automatically shows a space between numbers with a multiplication symbol:
| Out[222]= |  |
Multiply two complex numbers:
| Out[223]= |  |
Divide two numbers:
| Out[224]= |  |
Mathematica follows the ordinary order of operations in algebraic calculations:
| Out[225]= |  |
Compute the fifth power of 3:
| Out[226]= |  |
Compute the square root of 25:
| Out[227]= |  |
Mathematica displays the results of calculations using integers, rational numbers, or variables in exact form:
| Out[228]= |  |
Use N to get numerical results:
| Out[229]= |  |
Adding a decimal to any number forces a numerical result:
| Out[230]= |  |
This shows 40 significant digits:
| Out[231]= |  |
Approximate
using N:
| Out[232]= |  |
Get 50 decimal places:
| Out[233]= |  |
Calculate 50 significant digits of
:
| Out[234]= |  |
A large collection of common and well-known functions is built into Mathematica.
Evaluate trigonometric functions:
| Out[235]= |  |
| Out[236]= |  |
Evaluate the natural logarithm of numbers:
| Out[237]= |  |
Find the 125
prime number:
| Out[238]= |  |
Find the sum of the first billion positive integers:
| Out[239]= |  |
Set a value to a variable by using
:
| Out[240]= |  |
Display the value of
:
| Out[241]= |  |
Use
in a calculation:
| Out[242]= |  |
Define a function
:
Evaluate the function:
| Out[244]= |  |