Mathematica Module Guide
Prerequisite
We assume you have already had an introductory course in computer
programming or have experience writing moderately large, complex,
welldocumented programs. If not, we strongly recommend taking an
introductory programming course (CSE501N or CSE131) before you take
this course. Students without a formal introductory course in
programming generally don't do very well.
Introduction
In this module, you will learn how to use Mathematica (recently
rebranded as The Wolfram Language) for mathematical computation and
as a general purpose programming language. Most students in the class
have never used Mathematica before and most of those who have have not used
it as a general purpose programming language. If you are thinking
 Why do I have to learn Mathematica instead of using my favorite
language, {Python, R, MatLab, Java}?
The choice of programming language is mostly a matter of convenience
and personal preference. Most anything can be done in most any
language, but it may be easier in some languages than in others.

I have summarized my reasons for choosing
Mathematica
here.
What you will learn
After successful completion of this module you will have the basic
tools you need for developing sofware in Mathematica.The abilities
you should come away from this module with are:
 Use Mathematica notebooks to interactively carry out
simple symbolic and numeric mathematical computations.
 Use Mathematica documentation to find functions that do
something you want to do.
 Work with lists, matrices, and generalpurpose trees including
generating them, selecting parts of them, joining them, and mapping
functions over them.
 Write generalpurpose functions (code) in Mathematica including
defining local variables, applying functions repeatedly (looping or
mapping), and carrying out different computations depending on
the value of a variable or expression (branching).
 Write code that lives up to my standards of style and
readability.
 Write functional programs in which side effects are kept to a
minimum.
 Use Wolfram Workbench, an Eclipsebased integrated development
environment (IDE), for developing and testing Mathematica code.
 Carry out simple testdriven development.
 Use svn, version control system, to keep a history of your code
as you develop it and share it with others (teammates or the TAs).
Do this before the first class, if possible
Learning resources
There is a new online tutorial/textbook on Mathematica by Stephen
Wolfram which you can
find here. The
nice thing about it is that there are exercises at the end of each of
the short chapters. The bad thing is that it emphasizes the
interactive functionality over writing code so it takes a while to get
to some of the stuff you need. But definitely worth looking at! I will
try to make reference to it at appropriate places.
Day 1
In Class
 Help anyone who has not been able to install and open
Mathematica, Workbench, or an svn client.
 Overview of the class, topics covered, philosophy, and
mechanics.
 Self paced work: Download, read, and complete assignments in the
Mathematica notebook MathematicaQuickstart.nb.
If you click on
this link you should see the contents of the
directory that contains it. Then right click (control click) on it
and download it. It is a Mathematica notebook with the .nb
extension. This is a significant assignment that may take up to 5
hours to complete. Please start early and come to a help session if
needed.
Before the next class
 Turn in the notebook Mathematica Quickstart Guide with the
exercises completed. As you read, evaluate all input cells and make
sure you understand why the output is what it is. When you turn in the
notebook, all input cells must have corresponding output cells showing
that you evaluated them. In addition, you must have typed something
for each exercise, regardless of whether you were able to get it
correct. Turn in your new notebook and the modified
MathematicsQuickstart.nb by following the instructions linked
above. For your new notebook (and for the MathematicaQuickstart.nb if
its not already in your repository) you will need to do an "svn add" as
described in the instructions.

Read this section of the Wolfram online textbook:
Expressions and Their Structure
.
However, there is one style thing that I don't like about
this textbook and that is extensive use of "dingbat" shorthand such as
"@" for function application or "/@" for "Map". You'll need to be able
to read these as they are sometimes used in the documentation, but
please don't use them as they hurt readability. The only ones I really
approve of in code are & and # when defining anonymous functions.

Extra help: In these sections I will suggest sections of the
online Wolfram textbook that you may find helpful. They often present
similar material to what I've presented, but with different types of
examples and a diffferent perspective. Also this textbook contains
optional exercises that you can do to improve your understanding and
mastery. The solutions are provided in the final section.
Day 2
In Class

Review and practice homework turnin with svn.

Questions: Mathematica Quickstart Guide and associated assignment.

Presentation: Symbols, expressions, and forms (from “Day2PresentationExpressions.nb”).

Functions as data structures: introduction, selfpaced work, questions.

Recursive functions: introduction, selfpaced work, questions.

Functional programming: introduction, selfpaced work, questions.
Before the next class
Read:
To turn in: Complete and turn in all three notebooks:
Day 3
In Class
Before the next class
Read
To turn in:

myFirstProject Workbench project with the exercises
completed. Turn in your project by exporting it is as an archive file
(.zip) and committing the archive file to your svn repo.

PrecisionAccuracy.nb