
The aim of this book is to teach computer programming using examples
from mathematics and the natural sciences. We have chosen to use
the Python programming language because it combines remarkable expressive
power with very clean, simple, and compact syntax. Python is
easy to learn and very well suited for an introduction to computer programming.
Python is also quite similar to Matlab and a good language
for doing mathematical computing. It is easy to combine Python with
compiled languages, like Fortran, C, and C++, which are widely used
languages for scientific computations. A seamless integration of Python
with Java is offered by a special version of Python called Jython.
The examples in this book integrate programming with applications
to mathematics, physics, biology, and finance. The reader is expected to
have knowledge of basic onevariable calculus as taught in mathematicsintensive
programs in high schools. It is certainly an advantage to take
a university calculus course in parallel, preferably containing both classical
and numerical aspects of calculus. Although not strictly required,
a background in high school physics makes many of the examples more
meaningful.
Many introductory programming books are quite compact and focus
on listing functionality of a programming language. However, learning
to program is learning how to think as a programmer. This book has its
main focus on the thinking process, or equivalently: programming as a
problem solving technique. That is why most of the pages are devoted
to case studies in programming, where we define a problem and explain
how to create the corresponding program. New constructions and programming
styles (what we could call theory) is also usually introduced
via examples. Special attention is paid to verification of programs and
to finding errors. These topics are very demanding for mathematical
software, because the unavoidable numerical approximation errors are
possibly mixed with programming mistakes. 