# Preface

This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0330. It is primarily for students who have very little experience or have never used Mathematica and programming before and would like to learn more of the basics for this computer algebra system. As a friendly reminder, don't forget to clear variables in use and/or the kernel. The Mathematica commands in this tutorial are all written in bold black font, while Mathematica output is in normal font.

Finally, you can copy and paste all commands into your Mathematica notebook, change the parameters, and run them because the tutorial is under the terms of the GNU General Public License (GPL). You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043

# Getting Started

As mentioned above, Mathematica has many capabilities, such as the fact that one can write programs made up of Mathematica commands. The simplest way to use Mathematica, though, is as an interactive computing environment (essentially, a very fancy graphing calculator). You enter a command and the Mathematica kernel (the part of the software that actually does the computation) executes it and returns the result. Here is an example

In[1]= 2+3
Out[1]= 5

The input cell (labeled by In[1]:=) contains the expression 2+3, which Mathematica evaluates, returning the result (5) in the output cell (indicated by Out[1]=). I only type "2+3"; Mathematica automatically supplied the label "In[1]:=". Mathematica has a very useful shortcut for reusing the existing expressions.

• %     the last result generated
• %%    the next-to-last result generated
• %n    the result on output line Out[n]

Looking to the far right of this document, you will see the brackets that indicate the grouping of the material into the cells. (You will not see the brackets when the notebook is printed.) Moreover, the cells are nested. For example, the input and output cells are grouped together in an input/output cell, which is grouped together will the text cells and more input/output cells into this section of the document. Several sections are grouped together into this introductory chapter. Finally, all of the chapters are grouped in a single cell, the notebook.

Semicolons in Mathematica are used after an expression to suppress an output.

By default, when you type something in a Mathematica notebook, it is regarded as input. First of all, Mathematica can do arithmetic with integers and rational numbers exactly, regardless of the number of digits involved:

In[2]:= 13^5
Out[2]= 371293

In[3]:= 132/35 + 37/56
Out[3]= 1241/280
Note that Mathematica automatically put in the times symbol (*) between two numbers separated by space. So two inputs as
In[1]:= 2 3
In[2]:= 2*3
will lead to the same output (6). Mathematica knows the standard elementary functions, such as the trigonometric functions, logarithms and exponentials, the square root function, and so forth. It also knows the common mathematical constant π (=3.141926...), which can be entered either as Pi or, as \[Pi]. The easiest way to insert a Greek letter is to do it via the special characters palette. To find this palette, navigate to the Mathematica toolbar and find Palettes. Under Palettes, select Special Characters. The special characters assistant will then pop-up aside your notebook file. If you don’t see it immediately, it is likely hiding behind one your many windows you have up. Now all you need to do is select a Greek letter from the special characters bar and it will appear in your notebook file where your cursor is blinking. It is important to note that you should not use pi as a variable because it is a protected symbol by Mathematica and will always be equal to $$\pi \approx 3.1415926 \ldots .$$ For those who do not wish to use the toolbar, you can also type Greek letters right into your notebook file through three methods, all of which can be seen in the table, accessible from Wolfram web site.

Some famous constants are built-in Mathematica. We list some of them.

N[GoldenRatio]   (* golden ratio is (1+ sqrt(5))/2 *)
out[1] = 1.61803
If you want to see more decimal places, use the command SetPrecision:
SetPrecision[N[GoldenRatio], 16]
1.618033988749895
ContinuedFraction[Sqrt[20], 20]
out[1] = {4, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}