# 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

Return to computing page for the second course APMA0340

Return to Mathematica tutorial for the first course APMA0330

Return to Mathematica tutorial for the second course APMA0340

Return to the main page for the course APMA0330

Return to the main page for the course APMA0340

## Glossary

# Equal Signs

In *Mathematica*, there are many different commands that involve the equals sign, =. This sign does not just mean equals like it does in normal mathematics. The following commands are different ways of using the = sign.

In *Mathematica*, the **Set [=] **defines an expression to be displayed upon execution so it can be checked for errors.

The **SetDisplayed [:=] **command defines an expression that must be manually displayed. When you use this command, the solution or result of the command will not appear when you enter the equation.

Double equating** [==]** is used
for defining an equation or for testing if an equality is true. When you enter an equation in the form of `F[x]==A x+ b`

, you use this command; the regular** [=] ** is used to define assignments, while** [:=] **is used to represent the left-hand side in the form of the
right-hand side when this is unevaluated.

There are two assignment commands in *Mathematica*: immediate and delayed assignment. The immediate assignment is performed with the equal sign (=), say `x = y`

, which means "assign to x the value that *y*
has right now". This command has a literal equivalent **Set**: we could
equivalently write **Set[x,y]**. For delayed assignment, one has to use
(:=) (semicolon plus an equal sign), say `x:=y`

. The literal equivalent is the **SetDelayed** command, for instance `SetDelayed[x,y]`

. This means
"add to the global rule base a rule, which will substitute x every
time that x is encountered, by the value that y will have at that
moment". So, with this kind of assignment, the right hand side is not
evaluated at the moment of assignment, but is re-evaluated every time
when the left-hand side appears somewhere in the program. This is the
main difference between the two assignment operators, since with Set,
the left-hand side is assigned the value that the right-hand side has at the moment of
assignment, "once and for all".

Normally one uses **Set** (=) to define variables, and **SetDelayed** (:=) - to define functions, for which the
recomputation of the right-hand side, on a changed argument is a natural operation. However, in this respect
*Mathematica* differs from other programming environments in that the distinction between functions and
variables is achieved not on the level of keywords such as, or specific forms of functions declaration, but
essentially by the assignment operator that have been used to define the symbol (this is somewhat oversimplified),
and also to some extent by a type of global rule associated with the symbol (but again, it is decided based on the
syntactic form of the symbol, but at the moment of assignment). This allows one to work with functions and variables
on equal grounds. This lack of fundamental distinction between functions and variables is at the heart of the
functional style of programming, which is one of the most efficient programming styles in *Mathematica*
and which we will use a lot.

**Example: **
Supose we need to find the Jacobian materix

*Mathematica*, we first define functions:

`M[x_,y_]`

, so if you input values they are feed into the already-differentiated equations.
If now, you use ":" before the "=", (Set Delay), it evaluates the function when it is needed, hence it will evaluate the function only when values for *x* and *y* are set, hence it will not work, since one cannot differentiate a function with respect to 5 (a numerical value for example).

Return to Mathematica page

Return to the main page (APMA0330)

Return to the Part 1 (Plotting)

Return to the Part 2 (First Order ODEs)

Return to the Part 3 (Numerical Methods)

Return to the Part 4 (Second and Higher Order ODEs)

Return to the Part 5 (Series and Recurrences)

Return to the Part 6 (Laplace Transform)

Return to the Part 7 (Boundary Value Problems)