This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Arithmetic

You can do arithmetic with Mathematica just as you would on an electronic calculator.
This is the sum of two numbers.
In[1]:=
Click for copyable input
Out[1]=
Here the stands for division, and the stands for power.
In[2]:=
Click for copyable input
Out[2]=
Spaces denote multiplication in Mathematica. The front end automatically replaces spaces between numbers with light gray multiplication signs.
In[3]:=
Click for copyable input
Out[3]=
You can use a for multiplication if you want to.
In[4]:=
Click for copyable input
Out[4]=
You can type arithmetic expressions with parentheses.
In[5]:=
Click for copyable input
Out[5]=
Spaces are not needed, though they often make your input easier to read.
In[6]:=
Click for copyable input
Out[6]=
x^ypower
-xminus
x/ydivide
x y z or x*y*zmultiply
x+y+zadd

Arithmetic operations in Mathematica.

Arithmetic operations in Mathematica are grouped according to the standard mathematical conventions. As usual, , for example, means , and not . You can always control grouping by explicitly using parentheses.
This result is given in scientific notation.
In[7]:=
Click for copyable input
Out[7]=
You can enter numbers in scientific notation like this.
In[8]:=
Click for copyable input
Out[8]=
Or like this.
In[9]:=
Click for copyable input
Out[9]=
With Mathematica, you can perform calculations with a particular precision, usually higher than an ordinary calculator. When given precise numbers, Mathematica does not convert them to an approximate representation, but gives a precise result.
This gives the result in terms of rational numbers.
In[10]:=
Click for copyable input
Out[10]=
This gives the approximate numerical result.
In[11]:=
Click for copyable input
Out[11]=
This gives the approximate numerical result with 40 significant digits.
In[12]:=
Click for copyable input
Out[12]=