Part 1. The Mathematica Notebook
Section 2. Mixing Text and Mathematics
As a general rule a Mathematica notebook consists of alternating text and mathematics (input and output). Here is a typical example.
Annotating input and output: An example
Use Mathematica to find an antiderivative for the function y = and verify that it differentiates to y .
The following input entry defines the y variable as a function of x. We made it by pressing the down arrow, typing "y = Tan[x]/Sin[x]^2" and pressing [shift]-[return] ([shift]-[Enter] on a PC). Once the entry is processed an Input paragraph is automatically inserted. The text entry was made by choosing Text on the pop up paragraph style menu. (Remember to select Show Ruler and Show Toolbar on the Format menu.
In[1]:=
y=Tan[x]/Sin[x]^4
Out[1]=
Note that a function definition like this is made with the equals sign just as you would write it with paper and pencil. Note also that both the tangent function and the sin function must be capitalized in Mathematica. Moreover, the argument x must be placed inside of square brackets. Finally, you will observe that when Mathematica processed the input it "simplified" the fraction using trig identities.
Once y is defined as a function of x, an antiderivative function Y can be defined as follows.
In[3]:=
Y=Integrate[y,x]
Out[3]=
It is certainly not obvious that the function Y differentiates to y. A check that it does might go like this.
First differentiate Y with respect to x, naming the derivative function Y'. Note that the syntax for differentiation is simply D[Y,x].
In[4]:=
Y'=D[Y,x]
Out[4]=
Y' should be the same function as y, but its formula does not look like the one defining y. Mathematica's Simplify procedure could be useful here. Apply it to Y' with the entry
Simplify[Y']
In[5]:=
Simplify[Y']
Out[5]=
The output is identical to the "simplified" version of y. This shows that Y is an antiderivative for y.
End of Example.
So, the question is, how to get a text cell after an input/output cell?
Answer: Click in the white space below the output and use the pop up style menu to change the paragraph style from Input to Text.
Question: How to I insert a Text cell or Input/Output between two cells?
Answer: Click between the cells, note that the paragraph style is Input so just type away if you want to make a mathematics entry. If you want a text entry just use the pop up style menu to choose the style you want.
Note. Paragraph styles can also be accessed on the Format/Style menu. Pull it down now and you will also discover the keyboard equivalent for each paragraph style. Press Command-7 for the Text style and Command-9 for the Input style.
Hint. If you are in a text cell and want another text cell to follow, you can do it quickly by pressing Option-[return].
Undo it: Command-Z
Mathematica uses the standard keyboard equivalents for Copy: Command-C, Paste: Command-V, Cut (and copy): Command-X and Undo: Command-Z. Command-Z can be especially useful for editing out typing mistakes. Of course you can also just press [delete].
Delete all of it: Select the cell bracket and press [delete]
If you wish to delete a whole cell, select the cell bracket on the right and press the [delete] key. Remember, if you delete something then see that you made a mistake press Command-Z to undo the deletion.
Got to Next Section Previous Section
Created by Mathematica (September 10, 2004)