What do I need?
What do I need?#
We’ll use the Python programming language throughout the book. Python has consistently ranked in the top ten most popular programming languages in the TIOBE Programming Community Index since the early 2000s. While MATLAB has long been the de facto language to introduce students to scientific computing, universities and Academia all around the world have been transitionning to Python during the past ten years. This transition is being made possible thanks to the open-source nature of Python as well as to the continued development of its rich ecosystem for scientific computing, NumPy and SciPy being the workhorses. Some of the tips and tricks presented in this book will thus be useful only to Python programmers. Yet, the philosophy remains the same and might be applicable to some extent to other languages such as R or Julia.
Although we’ll only make use of standard Python packages such as NumPy, SciPy or Matplotlib, we strongly advice the reader to install Python using Anaconda. It is available for all major operating systems, whether it is Windows, MacOS or Linux and will come with all of the standard Python packages you may possibly need. It also ships some of the tools from Project Jupyter. The most important one is probably the Jupyter Notebooks. We make extensive use of these to ensure some form of interactive learning. If you are unfamiliar with Jupyter Notebooks, there are plenty of tutorials available on the Internet. Google is your friend!
The scientific computing ecosystem for Python is fairly rich, with packages dedicated to astronomy (AstroPy), symbolic computation (SymPy), graph theory and complex networks (NetworkX), image processing (scikit-image) or machine learning (scikit-learn) to name just a few. Yet, the three main players anybody interested in scientific computing needs to know are NumPy, SciPy and Matplotlib.
NumPy: It is THE fundamental package for scientific computing in Python. It provides a multidimensional array object, various derived objects (such as masked arrays and matrices), and an assortment of routines for fast operations on arrays, including mathematical, logical, shape manipulation, sorting, selecting, I/O, discrete Fourier transforms, basic linear algebra, basic statistical operations, random simulation and much more.
SciPy: It is a free and open-source Python library used for scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers and other tasks common in science and engineering. To some extent, SciPy can be seen as an extension of NumPy under steroids.
Matplotlib: It is the most popular plotting library for the Python programming language and its numerical mathematics extension NumPy. Matplotlib is designed to be as usable as MATLAB, with the ability to use Python, and the advantage of being free and open-source.
These are the three main packages we’ll use throughout the book and we expect the reader to be somewhat familiar with them. Although a quick tour of NumPy will be given in Chapter 1, we strongly advice readers unfamiliar with it to go through the excellent book From Python to NumPy by Nicolas Rougier, as well as his NumPy Tutorial. Numerous other resources are freely available online but, from the author’s point of view, these are probably some of the best. Regarding Matplotlib, Nicolas Rougier (once again) has an excellent introductory tutorial (here). The tutorials and gallery pages of the Matplotlib website also are good resources to see what can be done in Matplotlib and to get familiar with its syntax. Finally, the SciPy Lectures Notes are a good starting point to start to learn SciPy if needed.