Traditionally, science has been divided into experimental and theoretical disciplines, but nowadays computing plays an important role in science. Scientific computation is sometimes related to theory, and at other times to experimental work. Hence, it is often seen as a new third branch of science.
Figure from J.R. Johansson.
from IPython.display import Image Image(filename='../images/lifecycle_FPerez.png', width=600) # image from Fernando Perez
import math, we will have all the functions and statements defined in this module in the namespace '
math.', for example,
math.piis the $\pi$ constant and
math.cos(), the cosine function.
Python is also the name of the software with the most-widely used implementation of the language (maintained by the Python Software Foundation).
This implementation is written mostly in the C programming language and it is nicknamed CPython.
So, the following phrase is correct: download Python (the software) to program in Python (the language) because Python (both) is great!
The origin of the name for the Python language in fact is not because of the big snake, the author of the Python language, Guido van Rossum, named the language after Monty Python, a famous British comedy group in the 70's.
By coincidence, the Monty Python group was also interested in human movement science:
from IPython.display import YouTubeVideo YouTubeVideo('iV2ViNJFZC8', width=480, height=360, rel=0)
Python is not the best programming language for all needs and for all people. There is no such language.
Now, if you are doing scientific computing, chances are that Python is perfect for you because (and might also be perfect for lots of other needs):
from IPython.display import IFrame IFrame('http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-' + 'introductory-teaching-language-at-top-us-universities/fulltext', width='100%', height=450)
The Jupyter Notebook App is a server-client application that allows editing and running notebook documents via a web browser. The Jupyter Notebook App can be executed on a local desktop requiring no Internet access (as described in this document) or installed on a remote server and accessed through the Internet.
Notebook documents (or “notebooks”, all lower case) are documents produced by the Jupyter Notebook App which contain both computer code (e.g. python) and rich text elements (paragraph, equations, figures, links, etc...). Notebook documents are both human-readable documents containing the analysis description and the results (figures, tables, etc..) as well as executable documents which can be run to perform data analysis.
The easy way
The easiest way to get Python and the most popular packages for scientific programming is to install them with a Python distribution such as Anaconda.
In fact, you don't even need to install Python in your computer, you can run Python for scientific programming in the cloud using python.org, pythonanywhere, or repl.it.
The hard way
You can download Python and all individual packages you need and install them one by one. In general, it's not that difficult, but it can become challenging and painful for certain big packages heavily dependent on math, image visualization, and your operating system (i.e., Microsoft Windows).
Go to the Anaconda website and download the appropriate version for your computer (but download Anaconda3! for Python 3.x). The file is big (about 500 MB). From their website:
In your terminal window type and follow the instructions:
OS X Install
For the graphical installer, double-click the downloaded .pkg file and follow the instructions
For the command-line installer, in your terminal window type and follow the instructions:
Double-click the .exe file to install Anaconda and follow the instructions on the screen
# pip install version_information %load_ext version_information %version_information numpy, scipy, matplotlib, sympy, pandas, ipython, jupyter
|Python||3.7.6 64bit [GCC 7.3.0]|
|OS||Linux 5.3.0 29 generic x86_64 with debian buster sid|
|Tue Feb 11 01:58:24 2020 -03|
You might want an Integrated Development Environment (IDE) for programming in Python.
See Top 5 Python IDEs For Data Science for possible IDEs.
Soon there will be a new IDE for scientific computing with Python: JupyterLab, developed by the Jupyter team. See this video about JupyterLab.
There is a lot of good material in the Internet about Python for scientific computing, some of them are:
The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!