Today we are going to see how we can use Wolfram language as a calculator in the Notebook environment.

Doing most arithmetic in Wolfram language is as easy as just typing the expression you want to calculate.

2+3

In[]:=

5

Out[]=

45*3

In[]:=

135

Out[]=

In most cases Wolfram language will hold your results in fractional form

6/7

In[]:=

6

7

Out[]=

But you can always get your result in floating point if you want

N[6/7]

In[]:=

0.857143

Out[]=

If you need constants like Pi they are always available

Pi

In[]:=

π

Out[]=

We can also get the numerical value if we are interested.

N[Pi]

In[]:=

3.14159

Out[]=

Let’s increase the precision to 50 decimal places

N[Pi,50]

In[]:=

3.1415926535897932384626433832795028841971693993751

Out[]=

You could use the Greek π symbol in your own programs by typing the ESC key followed by pi and another ESC key.

π

The area of a Circle is given by

π

2

r

Using rule replacement we can fill in a value for r . The rule replacement starts after the /. symbol on the right. the arrow is made by pressing minus - followed by greater than > on your keyboard.

π/.r3

2

r

In[]:=

9π

Out[]=

Numerically

N[π/.r3]

2

r

In[]:=

28.2743

Out[]=

## Exercises

Exercises

1. Use the notebook environment to do some calculation of your own.

2. Edit the last line of code so that you calculate the area of the circle of radius 5 or any other number you want.