Saturday, May 2 2009
9:00 am
I am trying to get control of the appearance of these Mathematica notebooks.
I like the Stylesheet "Classroom" which gives a dark orange background when the cell defaults to Input status and a light orange background for the result of evaluating the contents of the cell. If I want to simply type a description then I can override the Stylesheet by simply pressing Alt-7 (as I am doing at the moment).
The next cell will show the effect of the Stylesheet formatting. I move the cursor below the cell and click the mouse to begin a new cell. The large square brackets at the right side of the window indicate the boundary of each cell.
In[16]:=
Out[16]=
In order to evaluate the contents of a cell I need to press Shift+Return.
Chapter 1 Getting Started
1.1 Starting Mathematica
When one starts Mathematica, a new window appears and a new file is created called a Mathematica notebook. Using File -> Save As ... initiates the standard way of saving a file in a location of one's choosing. This file has the suffic .nb and can only be opened by Mathematica.
It is also possible to use the command File -> Save As Special ... -> HTML to create a special set of files that will permit the notebook file to be read by a web browser.
1.2 Entering Expressions
As indicated above, if one creates a new cell and then types an arithmetic expression and presses Shift+Return, the expression is evaluated by Mathematica. A * stands for multiplication, a / for division, and ^ for exponentiation.
In[17]:=
Out[17]=
There is a palette under the File menu that provides a set of special symbols for formatting arithmetic and algebraic expresssions. Here are a few examples. ,
,
,
□. Thus one can have the following:
In[18]:=
Out[18]=
In[19]:=
Out[19]=
In[21]:=
Out[21]=
1.3 Editing Cells
One can alter the contents of any cell at any time by moving the cursor to the appropriate cell and retyping. For example, the previous input was originally the square root of 2. But I have just edited it to be the square root of 3. Easy.
1.4 Basic Arithmetic
One may use parentheses to group arithmetic expressions.
In[22]:=
Out[22]=
In[23]:=
Out[23]=
Mathematica also has implied multiplication. A blank space between two elements is treated as multiplication.
In[24]:=
Out[24]=
In[25]:=
Out[25]=
One can have more than one expression in a cell. Then when one presses Shift+Return, all of the expressions are evaluated.
In[26]:=
Out[26]=
Out[27]=
Out[28]=
Out[29]=
The last expression with the exclamation symbol represents the operation of factorial, which is the product of the integers between 1 and the number preceding the symbol. Here is another example:
In[30]:=
Out[30]=
In[31]:=
Out[31]=
1.5 Using Previous Results
This section is not important.
1.6 Exact versus Approximate
Mathematica normally tries to evaluate expressions exactly. For example:
In[32]:=
Out[32]=
Sometimes one wants this expressed as an approximate value. One way to obtain this is to have one of the terms in the expression expressed as a decimal.
In[33]:=
Out[33]=
1.7 Using Functions
Mathematica has thousands of built-in functions. These functions all begin with a capital letter.
In[34]:=
Out[34]=
In[35]:=
Out[35]=
There are also a few special numbers in mathematics, such as π, e (natural logarithm), and i (imaginary). One can obtain an approximate value for the first two of these numbers by using the built-in function N which returns the value to a specified number of decimal places.
In[36]:=
Out[36]=
In[37]:=
Out[37]=
The power of Mathematica is demonstrated when one types Euler's formula:
In[40]:=
Out[40]=
In[42]:=
Out[42]=
In[43]:=
Out[43]=
Hmmm. This doesn't seem right. This says the answer is 1 plus a tiny imaginary component. I would expect the answer to be -1 plus a small imaginary bit.
In[44]:=
Out[44]=
This might be be explored by examing the equivalent trigonometric expression. Later.
I am generally pleased with the format for this notebook. A good morning session.
10:00 am
Created by Mathematica (May 2, 2009) | ![]() |