Introduction to Mathematica (2013)

MATHEMATICA created by Steven Wolfram, a product of Wolfram Research, Inc. Mathematica is available for different operating systems, such as SGI, Sun, NeXT, Mac, DOS, and Windows. This introduction to Mathematica will help you to understand its use as a mathematical and programming language with numerical, symbolic, and graphical calculations.

Introduction to Mathematica

  1. A calculator for arithmetic, symbolic, and algebraic calculations
  2. A language for developing transformation rules, so that general mathematical relationships can be expressed
  3. An interactive environment for the exploration of numerical, symbolic, and graphical calculations
  4. A tool for preparing input to other programs, or to process output from other programs

Getting Started with Mathematica

Starting Mathematica will open a fresh window or a notebook, where we do all mathematical calculations and some graphics. Initially window’s title is “untitled-1” which can be changed after saving the notebook by name as desired. Mathematica notebook with text, graphics, and Mathematica input and output

Introduction to mathematica notebook

Entering Expressions

Type 1+1 in the notebook and press the ENTER key from the keyboard. You will get an answer in the next line of work area. This is called evaluating or entering the expression. Note that Mathematica places “In[1]:=” and “out[1]=” (without quotation marks) labels to 1+1 and 2 respectively. You will also see a set of brackets on the right side of the input and output. The innermost brackets enclose the input and output while the outer bracket (larger bracket) groups the input and output. Each bracket contains a cell. Each time you enter or change the input you will notice that the “In” and “Out” labels will also be changed.

Basic Arithmetic

Mathematica can perform basic operations of additions (+), subtraction (-), multiplication (*), division (/), exponentiation(^), etc. For example, write the following line for basic arithmetic in Mathematica

2*3+4^2
5*6
2(3+4)
(2-3+1)(1+2/3)-5^(-1)
6!

Using Previous Results in Mathematica

Often we need the output of the first (previous) calculations in our next (coming) computation. For this purpose % symbol can be used to refer to the output of the previous cell. For example,

2^5
% + 100

Here 2^5 is added in 100.

%% refers to the result before the last results (2nd last).

Exact vs Approximation

Mathematica can give approximate results; when we need

3^20/2^21 produces $\frac{3486784401}{2097152}$

We can force Mathematica to approximate results in decimals by putting decimals in expressions (with any digit or number) such as

3.0^20/ 2^21

For a decimal in number in an expression, Mathematica considers it to be an approximation rather than an exact number.

Wolfram Mathematica

R Frequently Asked Questions