## Simple Mathematica calculations

```   (1 + 2) * 3
```
and press Enter. You'll get the result:
```   9
```
You can omit the multiplication sign, and Mathematica is smart enough to know that it is implied:
```   (1 + 2) 3
9
```

But Mathematica can do a lot more than simple integer math. Try

```   102 / 9
```
You get the result
```   34 / 3
```
You see that Mathematica reduced the fraction to its simplest form by cancelling out common factors in the numerator and denominator. Also, notice that the result is still expressed as a fraction, not as a decimal number. This is because the fraction is more exact than any decimal approximation to it, and Mathematica tries to maintain as much accuracy as possible unless you specify otherwise.

To get a numerical approximation to this result, type

```   N[102 / 9]
```
You'll get the result
```   11.3333
```
The N[...] command tells Mathematica to evaluate the quantity in brackets numerically. If we want more decimal places, we can ask Mathematica to calculate the same thing to 20 digits:
```   N[102 / 9, 20]
11.333333333333333333
```

At this point, it's useful to introduce a Mathematica shortcut that lets us take the previous output cell and include it in the current input cell. Enter

```   102 / 9
```
and you'll get the standard Mathematica result:
```   34 / 3
```
Then enter in a new input cell
```   N[%, 20]
```
and you'll get the result
```   11.333333333333333333
```
just as before. The % symbol tells Mathematica to insert the output of the previous calculation.

Mathematica knows the basic mathematical functions like sine and cosine. Typically these functions have the name you would expect, but with their first letter capitalized. To take the sine of 34/3 radians, enter

```   Sin[%]
```
and you'll get the result
```   -0.9434996270154848971
```
Notice that Mathematica has kept 20 significant figures; it remembers that that was the accuracy of the previous output cell and passes that information along to the current cell.

If we try to compute the sine of 34/3 radians from scratch, we don't get the same result:

```   Sin[102 / 9]
Sin[34 / 3]
```
Here Mathematica has left both the fraction and the sine function unevaluated. To evaluate this numerically, we can use the N[...] command:
```   N[%, 20]
-0.9434996270154848971
```

Notice that Mathematica uses square brackets to delimit the argument of a function, instead of the more conventional parentheses. This is because parentheses are used exclusively for grouping in Mathematica, as in the calculation we entered at the beginning of this section:

```   (1 + 2) * 3
```

Other parts of the Mathematica tutorial: